Struct raii_change_tracker::DataTracker
[−]
[src]
pub struct DataTracker<T> where
T: Clone + PartialEq, { /* fields omitted */ }
Tracks changes to data and notifies listeners.
The data to be tracked is type T
.
Subsribe to changes by calling add_listener
.
See the module-level documentation for more details.
Methods
impl<T> DataTracker<T> where
T: Clone + PartialEq,
[src]
T: Clone + PartialEq,
pub fn new(value: T) -> DataTracker<T>
[src]
Create a new DataTracker
which takes ownership
of the data of type T
.
pub fn add_listener(&mut self) -> Receiver<(T, T)>
[src]
Add a callback that will be called just after a data change is detected.
Returns a Receiver which will receive messages whenever a change occurs.
To remove a listener, drop the Receiver.
pub fn as_tracked_mut(&mut self) -> Modifier<T>
[src]
Return a Modifier
which can be used to modify the owned data.
Trait Implementations
impl<T> AsRef<T> for DataTracker<T> where
T: Clone + PartialEq,
[src]
T: Clone + PartialEq,
Auto Trait Implementations
impl<T> Send for DataTracker<T> where
T: Send,
T: Send,
impl<T> Sync for DataTracker<T> where
T: Send + Sync,
T: Send + Sync,