pub trait AnyVarValue:
Debug
+ Any
+ Send
+ Sync {
// Required methods
fn clone_boxed(&self) -> BoxAnyVarValue;
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool;
fn type_name(&self) -> &'static str;
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> 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 + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> 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 + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> 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>(&self) -> Option<&T>where
T: VarValue,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: VarValue,
Returns some reference to the inner value if it is of type T, or
None if it isn’t.
Sourcepub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: VarValue,
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: VarValue,
Returns some mutable reference to the inner value if it is of type T, or
None if it isn’t.
Trait Implementations§
Source§impl PartialEq for dyn AnyVarValue
impl PartialEq for dyn AnyVarValue
Source§fn eq(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq(&self, other: &(dyn AnyVarValue + 'static)) -> bool
Tests for
self and other values to be equal, and is used by ==.