Struct drying_paint::WatchedCore
source · [−]pub struct WatchedCore<'ctx, T: ?Sized, O: ?Sized = DefaultOwner> { /* private fields */ }Expand description
This represents some value which will be interesting to watch. Watcher functions that reference this value will be re-run when this value changes.
Implementations
sourceimpl<'ctx, T, O: ?Sized> WatchedCore<'ctx, T, O>
impl<'ctx, T, O: ?Sized> WatchedCore<'ctx, T, O>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the WatchedCore, returning the wrapped value
sourceimpl<'ctx, T: ?Sized, O: ?Sized> WatchedCore<'ctx, T, O>
impl<'ctx, T: ?Sized, O: ?Sized> WatchedCore<'ctx, T, O>
sourcepub fn get(&self, ctx: WatchArg<'_, 'ctx, O>) -> &T
pub fn get(&self, ctx: WatchArg<'_, 'ctx, O>) -> &T
Get a referenced to the wrapped value, binding a watch closure.
sourcepub fn get_mut(&mut self, ctx: WatchArg<'_, 'ctx, O>) -> &mut T
pub fn get_mut(&mut self, ctx: WatchArg<'_, 'ctx, O>) -> &mut T
Get a mutable referenced to the wrapped value, notifying watchers that the value has changed.
pub fn get_mut_external(&mut self) -> &mut T
sourcepub fn get_unwatched(&self) -> &T
pub fn get_unwatched(&self) -> &T
Get a referenced to the wrapped value, without binding any watch closure.
sourceimpl<T: ?Sized> WatchedCore<'static, T, DefaultOwner>
impl<T: ?Sized> WatchedCore<'static, T, DefaultOwner>
sourceimpl<'ctx, T: Default, O: ?Sized> WatchedCore<'ctx, T, O>
impl<'ctx, T: Default, O: ?Sized> WatchedCore<'ctx, T, O>
sourceimpl<'ctx, T: PartialEq, O: ?Sized> WatchedCore<'ctx, T, O>
impl<'ctx, T: PartialEq, O: ?Sized> WatchedCore<'ctx, T, O>
sourcepub fn set_if_neq(&mut self, value: T, ctx: WatchArg<'_, 'ctx, O>)
pub fn set_if_neq(&mut self, value: T, ctx: WatchArg<'_, 'ctx, O>)
This function provides a way to set a value for a watched value only if is has changed. This is useful for cases where setting a value would otherwise cause an infinite loop.
sourceimpl<T: PartialEq> WatchedCore<'static, T, DefaultOwner>
impl<T: PartialEq> WatchedCore<'static, T, DefaultOwner>
sourcepub fn set_if_neq_auto(&mut self, value: T)
pub fn set_if_neq_auto(&mut self, value: T)
This function provides a way to set a value for a watched value only if is has changed. This is useful for cases where setting a value would otherwise cause an infinite loop.
Trait Implementations
sourceimpl<'ctx, T: Default, O: ?Sized> Default for WatchedCore<'ctx, T, O>
impl<'ctx, T: Default, O: ?Sized> Default for WatchedCore<'ctx, T, O>
Auto Trait Implementations
impl<'ctx, T, O = DefaultOwner> !RefUnwindSafe for WatchedCore<'ctx, T, O>
impl<'ctx, T, O = DefaultOwner> !Send for WatchedCore<'ctx, T, O>
impl<'ctx, T, O = DefaultOwner> !Sync for WatchedCore<'ctx, T, O>
impl<'ctx, T: ?Sized, O: ?Sized> Unpin for WatchedCore<'ctx, T, O> where
T: Unpin,
impl<'ctx, T, O = DefaultOwner> !UnwindSafe for WatchedCore<'ctx, T, O>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more