Struct data_tracker::DataTracker [] [src]

pub struct DataTracker<T, K> where
    T: Clone + PartialEq,
    K: Hash + Eq
{ /* fields omitted */ }

Tracks changes to data and notifies listeners.

The data to be tracked is type T.

Callbacks are stored in a HashMap with keys of type K.

See the module-level documentation for more details.

Methods

impl<T, K> DataTracker<T, K> where
    T: Clone + PartialEq,
    K: Hash + Eq
[src]

Create a new DataTracker which takes ownership of the data of type T.

Callbacks are registered via a key of type K.

Add a callback that will be called just after a data change is detected.

If a previous callback exists with the key, the original callback is returned as Some(original_callback). Otherwise, None is returned.

Remove callback.

If a callback exists with the key, it is removed and returned as Some(callback). Otherwise, None is returned.

Return a Modifier which can be used to modify the owned data.

Trait Implementations

impl<T, K> AsRef<T> for DataTracker<T, K> where
    T: Clone + PartialEq,
    K: Hash + Eq
[src]

Performs the conversion.