Add macro requirements #2

Merged
BobdaFett merged 3 commits from feature/macro-requirements into main 2025-09-03 15:52:50 +00:00
2 changed files with 3 additions and 3 deletions
Showing only changes of commit 16a7e49fbf - Show all commits

No files matched your search

+2 -2
View File
4
@@ -61,12 +61,12 @@ use syn::{parse_macro_input, Data, Ident};
/// ```
/// let user: User = User::new();
/// let user_reactive: UserReactive = user.as_reactive();
/// let custom_reactive: CustomTypeReactive = user_reactive.custom.as_reactive();
/// let custom_reactive: CustomTypeReactive = user_reactive.custom.get().as_reactive();
/// // And then convert back...
/// user_reactive.custom.set(custom_reactive.capture());
/// ```
/// If a shorthand for the `capture` and `as_reactive` functions are absolutely *required*, then this
/// macro is probably not the way to go - as of now, this functionality should be impmlemented manually.
/// macro is probably not the way to go - as of now, this functionality should be implemented manually.
#[proc_macro_derive(Reactive)]
pub fn make_reactive(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as syn::DeriveInput);
+1 -1
View File
@@ -65,7 +65,7 @@ pub trait AsReactive {
///
/// impl ReactiveCapture for UserReactive {
/// type CaptureType = User;
/// fn capture(self) -> User {
/// fn capture(&self) -> User {
/// User {
/// id: self.id.get(),
/// name: self.name.get()
2