Struct dust_lang::VariableMap
source · pub struct VariableMap { /* private fields */ }Expand description
A collection dust variables comprised of key-value pairs.
The inner value is a BTreeMap in order to allow VariableMap instances to be sorted and compared to one another.
Implementations§
source§impl VariableMap
impl VariableMap
sourcepub fn get_value(&self, identifier: &str) -> Result<Option<Value>>
pub fn get_value(&self, identifier: &str) -> Result<Option<Value>>
Returns a Value assigned to the identifer, allowing dot notation to retrieve Values that are /// nested in Lists or Maps. Returns None if there is no variable with a key matching the /// identifier. Returns an error if a Map or List is indexed incorrectly.
sourcepub fn set_value(&mut self, key: String, value: Value) -> Result<()>
pub fn set_value(&mut self, key: String, value: Value) -> Result<()>
Assigns a variable with a Value and the identifier as its key, allowing dot notation to assign nested lists and maps. Returns an error if a List or Map is indexed incorrectly.
Trait Implementations§
source§impl Clone for VariableMap
impl Clone for VariableMap
source§fn clone(&self) -> VariableMap
fn clone(&self) -> VariableMap
Returns a copy 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 VariableMap
impl Debug for VariableMap
source§impl Default for VariableMap
impl Default for VariableMap
source§impl<'de> Deserialize<'de> for VariableMap
impl<'de> Deserialize<'de> for VariableMap
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for VariableMap
impl Display for VariableMap
source§impl From<&Table> for VariableMap
impl From<&Table> for VariableMap
source§impl From<&VariableMap> for Table
impl From<&VariableMap> for Table
source§fn from(map: &VariableMap) -> Self
fn from(map: &VariableMap) -> Self
Converts to this type from the input type.
source§impl From<&mut VariableMap> for Table
impl From<&mut VariableMap> for Table
source§fn from(map: &mut VariableMap) -> Self
fn from(map: &mut VariableMap) -> Self
Converts to this type from the input type.
source§impl From<VariableMap> for Table
impl From<VariableMap> for Table
source§fn from(map: VariableMap) -> Self
fn from(map: VariableMap) -> Self
Converts to this type from the input type.
source§impl Ord for VariableMap
impl Ord for VariableMap
source§fn cmp(&self, other: &VariableMap) -> Ordering
fn cmp(&self, other: &VariableMap) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for VariableMap
impl PartialEq for VariableMap
source§fn eq(&self, other: &VariableMap) -> bool
fn eq(&self, other: &VariableMap) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd for VariableMap
impl PartialOrd for VariableMap
source§fn partial_cmp(&self, other: &VariableMap) -> Option<Ordering>
fn partial_cmp(&self, other: &VariableMap) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl Serialize for VariableMap
impl Serialize for VariableMap
impl Eq for VariableMap
impl StructuralEq for VariableMap
impl StructuralPartialEq for VariableMap
Auto Trait Implementations§
impl RefUnwindSafe for VariableMap
impl Send for VariableMap
impl Sync for VariableMap
impl Unpin for VariableMap
impl UnwindSafe for VariableMap
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.