pub struct VarModify<'a, T>where
T: VarValue,{ /* private fields */ }
Expand description
Represents the current value in a Var::modify
handler.
Implementations§
source§impl<'a, T> VarModify<'a, T>where
T: VarValue,
impl<'a, T> VarModify<'a, T>where
T: VarValue,
sourcepub fn set(&mut self, new_value: T)
pub fn set(&mut self, new_value: T)
Replace the value.
The variable will update if the new value is not equal to the previous after all modify closures apply.
sourcepub fn to_mut(&mut self) -> &mut T
pub fn to_mut(&mut self) -> &mut T
Returns a mutable reference for modification.
Note that this clones the current value if this is the first modify closure requesting it.
The variable will update if the new value is not equal to the previous after all modify closures apply.
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.
Add all custom tags.
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).
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for VarModify<'a, T>where
T: Freeze,
impl<'a, T> !RefUnwindSafe for VarModify<'a, T>
impl<'a, T> Send for VarModify<'a, T>
impl<'a, T> Sync for VarModify<'a, T>
impl<'a, T> Unpin for VarModify<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for VarModify<'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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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