Struct suzy::watch::WatchedCell[][src]

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

A Watched value which provides interior mutability. This provides correct behavior (triggering watch functions when changed) where Watched<Cell<T>> would not, and should be slightly more performant than RefCell<Watched<T>>.

Implementations

impl<T> WatchedCell<T> where
    T: ?Sized
[src]

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

Returns a mutable reference to the watched data.

This call borrows the WatchedCell mutably (at compile-time) which guarantees that we possess the only reference.

pub fn watched(&self)[src]

Treat this WatchedCell as watched, without fetching the actual value.

impl<T> WatchedCell<T>[src]

pub fn new(value: T) -> WatchedCell<T>[src]

Create a new WatchedCell

pub fn set(&self, value: T)[src]

Sets the watched value

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

Unwraps the WatchedCell, returning the contained value

pub fn replace(&self, value: T) -> T[src]

Replaces the contained value and returns the previous value

impl<T> WatchedCell<T> where
    T: Copy
[src]

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

Returns a copy of the watched value

impl<T> WatchedCell<T> where
    T: Default
[src]

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

Takes the watched value, leaving Default::default() in its place

Trait Implementations

impl<T> Clone for WatchedCell<T> where
    T: Copy
[src]

impl<T> Default for WatchedCell<T> where
    T: Default + ?Sized
[src]

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

Auto Trait Implementations

impl<T> !RefUnwindSafe for WatchedCell<T>

impl<T> !Send for WatchedCell<T>

impl<T> !Sync for WatchedCell<T>

impl<T: ?Sized> Unpin for WatchedCell<T> where
    T: Unpin

impl<T> !UnwindSafe for WatchedCell<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<!> for T[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.