Struct drying_paint::WatchedCellCore
source · pub struct WatchedCellCore<'ctx, T: ?Sized, O: ?Sized = DefaultOwner> { /* private fields */ }
Expand description
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§
source§impl<'ctx, T: ?Sized, O: ?Sized> WatchedCellCore<'ctx, T, O>
impl<'ctx, T: ?Sized, O: ?Sized> WatchedCellCore<'ctx, T, O>
source§impl<'ctx, T, O: ?Sized> WatchedCellCore<'ctx, T, O>
impl<'ctx, T, O: ?Sized> WatchedCellCore<'ctx, T, O>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwraps the WatchedCell, returning the contained value
sourcepub fn get(&self, ctx: WatchArg<'_, 'ctx, O>) -> Twhere
T: Copy,
pub fn get(&self, ctx: WatchArg<'_, 'ctx, O>) -> Twhere
T: Copy,
Returns a copy of the watched value
pub fn get_unwatched(&self) -> Twhere
T: Copy,
pub fn set_external(&self, value: T)
sourcepub fn replace(&self, value: T, ctx: WatchArg<'_, 'ctx, O>) -> T
pub fn replace(&self, value: T, ctx: WatchArg<'_, 'ctx, O>) -> T
Replaces the contained value and returns the previous value
pub fn replace_external(&self, value: T) -> T
sourcepub fn take(&self, ctx: WatchArg<'_, 'ctx, O>) -> Twhere
T: Default,
pub fn take(&self, ctx: WatchArg<'_, 'ctx, O>) -> Twhere
T: Default,
Takes the watched value, leaving Default::default()
in its place
pub fn take_external(&self) -> Twhere
T: Default,
pub fn set_if_neq(&self, value: T, ctx: WatchArg<'_, 'ctx, O>)
pub fn set_if_neq_external(&self, value: T)
source§impl<T: ?Sized> WatchedCellCore<'static, T, DefaultOwner>
impl<T: ?Sized> WatchedCellCore<'static, T, DefaultOwner>
pub fn get_auto(&self) -> T
pub fn get_mut_auto(&mut self) -> &mut T
pub fn watched_auto(&self)
pub fn set_auto(&self, value: T)where
T: Sized,
pub fn replace_auto(&self, value: T) -> Twhere
T: Sized,
pub fn take_auto(&self) -> Twhere
T: Default,
pub fn set_if_neq_auto(&self, value: T)
Trait Implementations§
source§impl<'ctx, T, O: ?Sized> From<T> for WatchedCellCore<'ctx, T, O>
impl<'ctx, T, O: ?Sized> From<T> for WatchedCellCore<'ctx, T, O>
source§impl<'a, 'ctx, O, T> WatchedValueCore<'ctx, O> for &'a WatchedCellCore<'ctx, T, O>
impl<'a, 'ctx, O, T> WatchedValueCore<'ctx, O> for &'a WatchedCellCore<'ctx, T, O>
Auto Trait Implementations§
impl<'ctx, T, O = DefaultOwner> !RefUnwindSafe for WatchedCellCore<'ctx, T, O>
impl<'ctx, T, O = DefaultOwner> !Send for WatchedCellCore<'ctx, T, O>
impl<'ctx, T, O = DefaultOwner> !Sync for WatchedCellCore<'ctx, T, O>
impl<'ctx, T: ?Sized, O: ?Sized> Unpin for WatchedCellCore<'ctx, T, O>where
T: Unpin,
impl<'ctx, T, O = DefaultOwner> !UnwindSafe for WatchedCellCore<'ctx, T, O>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more