[][src]Struct track::Tracker

pub struct Tracker<'borrow, 'notifier, C, S, I> where
    C: TrackableMarker,
    S: SerializationStrategy,
    I: Identifier
{ /* fields omitted */ }

Tracks value modifications of a type and sends events with these changes.

The Tracker implements DerefMut which makes it possible to treat this tracker as if you are working with the type you track. On Drop it checks if modifications have been made. If this is the case only the modified fields in an event will be sent to the given sender.

Methods

impl<'borrow, 'notifier, C, S, I> Tracker<'borrow, 'notifier, C, S, I> where
    C: TrackableMarker,
    S: SerializationStrategy,
    I: Identifier
[src]

pub fn new(
    borrow: &'borrow mut C,
    notifier: &'notifier Sender<ModificationEvent<I>>,
    serialization: S,
    identifier: I
) -> Tracker<'borrow, 'notifier, C, S, I>
[src]

Constructs a new tracker.

  • borrow: mutable reference to the object which modifications are tracked.
  • notifier: a sender where mutation events are sent.
  • serialization: an instance of a type that implements SerializationStrategy strategy. This serializer is needed to monitor the changes and the serialized mutations are sent along with the event.
  • identifier: An identifier with which you can relate the modification event to your type. The identifier should implement Identifier

Trait Implementations

impl<'borrow, 'notifier, C, S, I> Deref for Tracker<'borrow, 'notifier, C, S, I> where
    C: TrackableMarker,
    S: SerializationStrategy,
    I: Identifier
[src]

type Target = C

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Returns a reference to the underlying type being tracked.

impl<'borrow, 'notifier, C, S, I> DerefMut for Tracker<'borrow, 'notifier, C, S, I> where
    C: TrackableMarker,
    S: SerializationStrategy,
    I: Identifier
[src]

fn deref_mut(&mut self) -> &mut Self::Target[src]

Returns a mutable reference to the underlying type being tracked.

impl<'borrow, 'notifier, C, S, I> Drop for Tracker<'borrow, 'notifier, C, S, I> where
    C: TrackableMarker,
    S: SerializationStrategy,
    I: Identifier
[src]

fn drop(&mut self)[src]

Checks to see if any field values have changed. If this is the case, the changed fields will be packed into an event and an event will be sent.

Auto Trait Implementations

impl<'borrow, 'notifier, C, S, I> RefUnwindSafe for Tracker<'borrow, 'notifier, C, S, I> where
    C: RefUnwindSafe,
    I: RefUnwindSafe,
    S: RefUnwindSafe

impl<'borrow, 'notifier, C, S, I> Send for Tracker<'borrow, 'notifier, C, S, I>

impl<'borrow, 'notifier, C, S, I> Sync for Tracker<'borrow, 'notifier, C, S, I>

impl<'borrow, 'notifier, C, S, I> Unpin for Tracker<'borrow, 'notifier, C, S, I> where
    C: Unpin,
    I: Unpin,
    S: Unpin

impl<'borrow, 'notifier, C, S, I> !UnwindSafe for Tracker<'borrow, 'notifier, C, S, I>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.