[][src]Struct drying_paint::Watcher

pub struct Watcher<T: ?Sized> { /* fields omitted */ }

Watcher is a structure designed to hold some data along with associated functions which will run when watched data changes.

Implementations

impl<T: WatcherInit> Watcher<T>[src]

pub fn create(data: T) -> Self[src]

Create a new Watcher. After creation, will run WatcherInit::init for the stored data. Watchers need to be created inside WatchContext::allow_watcher_access() in order to observe aliasing rules.

pub fn into_inner(self) -> T[src]

Consume the Watcher and return the data stored inside. Watch callbacks will no longer run.

impl<T: WatcherInit + ?Sized> Watcher<T>[src]

pub fn data(&self) -> &T[src]

Get an immutable reference to the data stored in this Watcher. In order to ensure aliasing rules are maintained, this function will panic if called outside a watch callback or WatchContext::allow_watcher_access

pub fn data_mut(&mut self) -> &mut T[src]

Get an mutable reference to the data stored in this Watcher. In order to ensure aliasing rules are maintained, this function will panic if called outside a watch callback or WatchContext::allow_watcher_access

impl<T: WatcherInit + Default> Watcher<T>[src]

pub fn new() -> Self[src]

Create a Watcher with default data. After creation, will run WatcherInit::init for the stored data.

impl<T: 'static> Watcher<T>[src]

pub fn id(&self) -> WatcherId[src]

Get a value representing a unique id for this watcher. This value may outlive the watcher, and will never compare equal to a value returned by the id method of a Watcher other than this one.

Trait Implementations

impl<T: WatcherInit + Clone> Clone for Watcher<T>[src]

impl<T: WatcherInit + Default> Default for Watcher<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Watcher<T>

impl<T> !Send for Watcher<T>

impl<T> !Sync for Watcher<T>

impl<T: ?Sized> Unpin for Watcher<T>

impl<T> !UnwindSafe for Watcher<T>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.