pub trait AnyVarValue:
Debug
+ Any
+ Send
+ Sync {
// Required methods
fn clone_boxed(&self) -> BoxAnyVarValue;
fn eq_any(&self, other: &dyn AnyVarValue) -> bool;
fn type_name(&self) -> &'static str;
fn try_swap(&mut self, other: &mut dyn AnyVarValue) -> bool;
}Expand description
Represents any variable value.
§Trait Alias
This trait is used like a type alias for traits and is already implemented for all types it can apply to.
See VarValue<T> for more details.
Required Methods§
Sourcefn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Clone the value.
Sourcefn eq_any(&self, other: &dyn AnyVarValue) -> bool
fn eq_any(&self, other: &dyn AnyVarValue) -> bool
Gets if self and other are equal.
Sourcefn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Value type name.
Note that this string is not stable and should be used for debug only.
Sourcefn try_swap(&mut self, other: &mut dyn AnyVarValue) -> bool
fn try_swap(&mut self, other: &mut dyn AnyVarValue) -> bool
Swap value with other if both are of the same type.
Implementations§
Source§impl dyn AnyVarValue
impl dyn AnyVarValue
Sourcepub fn downcast_ref<T: VarValue>(&self) -> Option<&T>
pub fn downcast_ref<T: VarValue>(&self) -> Option<&T>
Returns some reference to the inner value if it is of type T, or
None if it isn’t.
Sourcepub fn downcast_mut<T: VarValue>(&mut self) -> Option<&mut T>
pub fn downcast_mut<T: VarValue>(&mut self) -> Option<&mut T>
Returns some mutable reference to the inner value if it is of type T, or
None if it isn’t.