Struct simple_observable::Observable
source · [−]pub struct Observable<Data> { /* private fields */ }Implementations
sourceimpl<Data> Observable<Data>
impl<Data> Observable<Data>
pub fn new(value: Data) -> Observable<Data>
sourcepub fn change(&mut self, change_fn: fn(_: &mut Data))
pub fn change(&mut self, change_fn: fn(_: &mut Data))
It takes as an argument a function to change the value of the data, and then notifies all listeners. It doesn’t matter if the new data value is different from the previous ones, the listeners will still be notified.
pub fn add_listener(&mut self, listener: fn(_: &Data))
Trait Implementations
Auto Trait Implementations
impl<Data> RefUnwindSafe for Observable<Data> where
Data: RefUnwindSafe,
impl<Data> Send for Observable<Data> where
Data: Send,
impl<Data> Sync for Observable<Data> where
Data: Sync,
impl<Data> Unpin for Observable<Data> where
Data: Unpin,
impl<Data> UnwindSafe for Observable<Data> where
Data: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more