Struct suzy::watch::WatchedCell [−][src]
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]
T: ?Sized,
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]
T: Copy,
impl<T> WatchedCell<T> where
T: Default,
[src]
T: Default,
Trait Implementations
impl<T> Clone for WatchedCell<T> where
T: Copy,
[src]
T: Copy,
pub fn clone(&self) -> WatchedCell<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Default for WatchedCell<T> where
T: Default + ?Sized,
[src]
T: Default + ?Sized,
pub fn default() -> WatchedCell<T>
[src]
impl<T> From<T> for WatchedCell<T>
[src]
pub fn from(value: T) -> 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,
T: Unpin,
impl<T> !UnwindSafe for WatchedCell<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,