pub struct NeoMap<K, V> { /* private fields */ }Expand description
Neo N3 Map type
Implementations§
Source§impl<K, V> NeoMap<K, V>
impl<K, V> NeoMap<K, V>
pub fn new() -> NeoMap<K, V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>where
K: PartialEq,
Sourcepub fn get(&self, key: &K) -> Option<&V>where
K: PartialEq,
pub fn get(&self, key: &K) -> Option<&V>where
K: PartialEq,
Gets a reference to the value associated with the given key.
§Performance
This operation is O(n) as it performs a linear search. Consider using a HashMap for O(1) lookups if performance is critical.
Sourcepub fn get_mut(&mut self, key: &K) -> Option<&mut V>where
K: PartialEq,
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>where
K: PartialEq,
Gets a mutable reference to the value associated with the given key.
§Performance
This operation is O(n) as it performs a linear search.
Sourcepub fn remove(&mut self, key: &K) -> Option<V>where
K: PartialEq,
pub fn remove(&mut self, key: &K) -> Option<V>where
K: PartialEq,
Removes the key-value pair associated with the given key.
§Performance
This operation is O(n) due to the element removal.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)>
Trait Implementations§
Source§impl<'de, K, V> Deserialize<'de> for NeoMap<K, V>
impl<'de, K, V> Deserialize<'de> for NeoMap<K, V>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NeoMap<K, V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NeoMap<K, V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<K, V> Serialize for NeoMap<K, V>
impl<K, V> Serialize for NeoMap<K, V>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<K, V> Eq for NeoMap<K, V>
impl<K, V> StructuralPartialEq for NeoMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for NeoMap<K, V>
impl<K, V> RefUnwindSafe for NeoMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for NeoMap<K, V>
impl<K, V> Sync for NeoMap<K, V>
impl<K, V> Unpin for NeoMap<K, V>
impl<K, V> UnwindSafe for NeoMap<K, V>where
K: UnwindSafe,
V: UnwindSafe,
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