pub struct MemoryVariableStorage(/* private fields */);Expand description
A simple concrete implementation of VariableStorage that keeps all variables in memory.
Implementations§
Source§impl MemoryVariableStorage
impl MemoryVariableStorage
Sourcepub fn new() -> MemoryVariableStorage
pub fn new() -> MemoryVariableStorage
Creates a new empty MemoryVariableStorage.
Trait Implementations§
Source§impl Clone for MemoryVariableStorage
impl Clone for MemoryVariableStorage
Source§fn clone(&self) -> MemoryVariableStorage
fn clone(&self) -> MemoryVariableStorage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryVariableStorage
impl Debug for MemoryVariableStorage
Source§impl Default for MemoryVariableStorage
impl Default for MemoryVariableStorage
Source§fn default() -> MemoryVariableStorage
fn default() -> MemoryVariableStorage
Returns the “default value” for a type. Read more
Source§impl VariableStorage for MemoryVariableStorage
impl VariableStorage for MemoryVariableStorage
Source§fn clone_shallow(&self) -> Box<dyn VariableStorage>
fn clone_shallow(&self) -> Box<dyn VariableStorage>
Creates a shallow clone of this variable storage, i.e. a clone that
shares the same underlying storage and will thus be perfectly in sync
with the original instance.
Source§fn set(
&mut self,
name: String,
value: YarnValue,
) -> Result<(), VariableStorageError>
fn set( &mut self, name: String, value: YarnValue, ) -> Result<(), VariableStorageError>
Sets the value of a variable. Must fail with a
VariableStorageError::InvalidVariableName if the variable name does not start with a $.Source§fn get(&self, name: &str) -> Result<YarnValue, VariableStorageError>
fn get(&self, name: &str) -> Result<YarnValue, VariableStorageError>
Gets the value of a variable. Must fail with a
VariableStorageError::InvalidVariableName if the variable name does not start with a $.
If the variable is not defined, must fail with a VariableStorageError::VariableNotFound.Source§fn extend(
&mut self,
values: HashMap<String, YarnValue>,
) -> Result<(), VariableStorageError>
fn extend( &mut self, values: HashMap<String, YarnValue>, ) -> Result<(), VariableStorageError>
Extends this variable storage with the given values. Must fail with a
VariableStorageError::InvalidVariableName if any of the variable names do not start with a $.
Existing variables must be overwritten.Source§fn variables(&self) -> HashMap<String, YarnValue>
fn variables(&self) -> HashMap<String, YarnValue>
Returns a map of all variables in this variable storage.
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Gets the
VariableStorage as a trait object.
This allows retrieving the concrete type by downcasting, using the downcast_ref method available through the Any trait.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Gets the
VariableStorage as a mutable trait object.
This allows retrieving the concrete type by downcasting, using the downcast_mut method available through the Any trait.Auto Trait Implementations§
impl Freeze for MemoryVariableStorage
impl RefUnwindSafe for MemoryVariableStorage
impl Send for MemoryVariableStorage
impl Sync for MemoryVariableStorage
impl Unpin for MemoryVariableStorage
impl UnsafeUnpin for MemoryVariableStorage
impl UnwindSafe for MemoryVariableStorage
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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
Mutably borrows from an owned value. Read more