pub enum Map {
Dynamic(IndexMap<ValueContainer, ValueContainer, RandomState>),
Structural(Vec<(ValueContainer, ValueContainer)>),
StructuralWithStringKeys(Vec<(String, ValueContainer)>),
}Variants§
Dynamic(IndexMap<ValueContainer, ValueContainer, RandomState>)
Structural(Vec<(ValueContainer, ValueContainer)>)
StructuralWithStringKeys(Vec<(String, ValueContainer)>)
Implementations§
Source§impl Map
impl Map
pub fn new( entries: IndexMap<ValueContainer, ValueContainer, RandomState>, ) -> Self
pub fn is_structural(&self) -> bool
pub fn size(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn get<'a>(
&self,
key: impl Into<ValueKey<'a>>,
) -> Result<&ValueContainer, KeyNotFoundError>
pub fn get<'a>( &self, key: impl Into<ValueKey<'a>>, ) -> Result<&ValueContainer, KeyNotFoundError>
Gets a value in the map by reference. Returns None if the key is not found.
Sourcepub fn has<'a>(&self, key: impl Into<ValueKey<'a>>) -> bool
pub fn has<'a>(&self, key: impl Into<ValueKey<'a>>) -> bool
Checks if the map contains the given key.
Sourcepub fn delete<'a>(
&mut self,
key: impl Into<ValueKey<'a>>,
) -> Result<ValueContainer, MapAccessError>
pub fn delete<'a>( &mut self, key: impl Into<ValueKey<'a>>, ) -> Result<ValueContainer, MapAccessError>
Removes a key from the map, returning the value if it existed.
Sourcepub fn clear(&mut self) -> Result<(), MapAccessError>
pub fn clear(&mut self) -> Result<(), MapAccessError>
Clears all entries in the map, returning an error if the map is not dynamic.
Trait Implementations§
Source§impl<K, V> From<IndexMap<K, V, RandomState>> for Map
impl<K, V> From<IndexMap<K, V, RandomState>> for Map
Source§fn from(map: IndexMap<K, V, RandomState>) -> Self
fn from(map: IndexMap<K, V, RandomState>) -> Self
Converts to this type from the input type.
Source§impl From<Vec<(ValueContainer, ValueContainer)>> for Map
impl From<Vec<(ValueContainer, ValueContainer)>> for Map
Source§fn from(vec: Vec<(ValueContainer, ValueContainer)>) -> Self
fn from(vec: Vec<(ValueContainer, ValueContainer)>) -> Self
Create a dynamic map from a vector of value containers.
Source§impl<K, V> FromIterator<(K, V)> for Map
impl<K, V> FromIterator<(K, V)> for Map
Source§impl<'a> IntoIterator for &'a mut Map
impl<'a> IntoIterator for &'a mut Map
Source§type Item = (BorrowedMapKey<'a>, &'a mut ValueContainer)
type Item = (BorrowedMapKey<'a>, &'a mut ValueContainer)
The type of the elements being iterated over.
Source§type IntoIter = MapMutIterator<'a>
type IntoIter = MapMutIterator<'a>
Which kind of iterator are we turning this into?
Source§impl IntoIterator for Map
impl IntoIterator for Map
Source§impl StructuralEq for Map
impl StructuralEq for Map
Source§fn structural_eq(&self, other: &Self) -> bool
fn structural_eq(&self, other: &Self) -> bool
Check if two values are equal, ignoring the type.
impl Eq for Map
impl StructuralPartialEq for Map
Auto Trait Implementations§
impl Freeze for Map
impl !RefUnwindSafe for Map
impl !Send for Map
impl !Sync for Map
impl Unpin for Map
impl UnsafeUnpin for Map
impl !UnwindSafe for Map
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more