Trait sindra::scope::memory::MemoryStore
[−]
[src]
pub trait MemoryStore<Val> { fn set(
&mut self,
ident: Identifier,
value: Val
) -> Result<Option<Val>, String>; fn get(&self, ident: &Identifier) -> Option<Val>; }
Methods for setting and getting values in a memory store. This is used instead of a
MemoryTable
when a structure (like a scope) may search through multiple memory tables to
retrieve the value.
Required Methods
fn set(&mut self, ident: Identifier, value: Val) -> Result<Option<Val>, String>
Sets (or updates) the value in memory for an identifier. Returns the previous value (if exists). Typically, the identifier should already exist in the store, but may not have an existing value.
Failures
Can fail if setting value for an identifier that doesn't otherwise exist in the store (unless this is allowed in a particular implementation).
fn get(&self, ident: &Identifier) -> Option<Val>
Retrieves the value for a particular identifier, if exists.
Implementors
impl<Val: Clone, T> MemoryStore<Val> for Scope<T> where
T: MemoryTable<Val>,