pub struct Signal<T>(/* private fields */);Expand description
A Signal is like a varible, but it can update it’s dependencies when it
changes.
let x = Signal::new(0);
let next_x = x.read().map(|x| x + 1);
assert_eq!(*next_x.current(), 1);
x.write().set(2);
assert_eq!(*next_x.current(), 3);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Signal<T>
impl<T> !RefUnwindSafe for Signal<T>
impl<T> !Send for Signal<T>
impl<T> !Sync for Signal<T>
impl<T> Unpin for Signal<T>
impl<T> !UnwindSafe for Signal<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more