pub struct VarModify<'s, 'a, T: VarValue> { /* private fields */ }
Expand description
Mutable reference to a variable value.
The variable will notify an update only on deref_mut
.
Implementations§
Source§impl<'s, 'a, T: VarValue> VarModify<'s, 'a, T>
impl<'s, 'a, T: VarValue> VarModify<'s, 'a, T>
Sourcepub fn set(&mut self, new_value: impl Into<T>) -> bool
pub fn set(&mut self, new_value: impl Into<T>) -> bool
Replace the value if not equal.
Note that you can also deref_mut to modify the value.
Custom tags that will be shared with the var hooks if the value updates.
The tags where set by previous modify closures or this one during this update cycle, so tags can also be used to communicate between modify closures.
Sourcepub fn push_tag(&mut self, tag: impl AnyVarValue)
pub fn push_tag(&mut self, tag: impl AnyVarValue)
Add a custom tag object that will be shared with the var hooks if the value updates.
Sourcepub fn set_modify_importance(&mut self, importance: usize)
pub fn set_modify_importance(&mut self, importance: usize)
Sets a custom AnyVar::modify_importance
value.
Note that the modify info is already automatically set, using a custom value here can easily break all future modify requests for this variable. The importance is set even if the variable does not update (no actual value change or update request).
Sourcepub fn as_any(&mut self) -> &mut AnyVarModify<'a>
pub fn as_any(&mut self) -> &mut AnyVarModify<'a>
Type erased reference.
Trait Implementations§
Auto Trait Implementations§
impl<'s, 'a, T> Freeze for VarModify<'s, 'a, T>
impl<'s, 'a, T> !RefUnwindSafe for VarModify<'s, 'a, T>
impl<'s, 'a, T> Send for VarModify<'s, 'a, T>
impl<'s, 'a, T> Sync for VarModify<'s, 'a, T>
impl<'s, 'a, T> Unpin for VarModify<'s, 'a, T>
impl<'s, 'a, T> !UnwindSafe for VarModify<'s, 'a, T>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more