pub struct ValueNotifier<T> { /* private fields */ }Expand description
A notifier that holds a value, and tells its listeners when the value changes.
Cloning gives another handle to the same value.
Implementations§
Trait Implementations§
Source§impl<T> Clone for ValueNotifier<T>
impl<T> Clone for ValueNotifier<T>
Source§impl<T: Debug> Debug for ValueNotifier<T>
impl<T: Debug> Debug for ValueNotifier<T>
Source§impl<T: Default + 'static> Default for ValueNotifier<T>
impl<T: Default + 'static> Default for ValueNotifier<T>
Source§impl<T> Listenable for ValueNotifier<T>
impl<T> Listenable for ValueNotifier<T>
Source§fn add_listener(&self, listener: impl Fn() + 'static) -> Subscription
fn add_listener(&self, listener: impl Fn() + 'static) -> Subscription
Calls
listener whenever this changes, until the returned Subscription is
dropped.Auto Trait Implementations§
impl<T> !RefUnwindSafe for ValueNotifier<T>
impl<T> !Send for ValueNotifier<T>
impl<T> !Sync for ValueNotifier<T>
impl<T> !UnwindSafe for ValueNotifier<T>
impl<T> Freeze for ValueNotifier<T>
impl<T> Unpin for ValueNotifier<T>
impl<T> UnsafeUnpin for ValueNotifier<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