#[derive(LiftSync)]Expand description
Derive macro to lift a struct into a thread-safe reactive SignalSync.
Applying #[derive(LiftSync)] to a struct generates an inner unwrapped struct and
a lift(self) method that produces a crate::signal_sync::SignalSync<'a, _Inner> where
any fields of type SignalSync<'a, T> are replaced by their inner T in the
generated inner struct. The generated lift method wires up thread-safe reactions
so that changes to any signal fields propagate into the resulting lifted SignalSync.
Example:
use crate::signal_sync::SignalSync;
#[derive(LiftSync)]
struct ExampleSync<'a> {
a: SignalSync<'a, i32>,
b: String,
}
let example = ExampleSync { a: SignalSync::new(1), b: "hi".to_string() };
let lifted = example.lift(); // SignalSync<'a, _ExampleSync>
lifted.with(|inner| println!("a = {}", inner.a));