Struct near_sdk::collections::LookupMap [−][src]
An non-iterable implementation of a map that stores its content directly on the trie.
Implementations
impl<K, V> LookupMap<K, V>
[src]
pub fn new(key_prefix: Vec<u8>) -> Self
[src]
Create a new map. Use key_prefix
as a unique prefix for keys.
pub fn insert_raw(
&mut self,
key_raw: &[u8],
value_raw: &[u8]
) -> Option<Vec<u8>>
[src]
&mut self,
key_raw: &[u8],
value_raw: &[u8]
) -> Option<Vec<u8>>
Inserts a serialized key-value pair into the map.
If the map did not have this key present, None
is returned. Otherwise returns
a serialized value. Note, the keys that have the same hash value are undistinguished by
the implementation.
pub fn remove_raw(&mut self, key_raw: &[u8]) -> Option<Vec<u8>>
[src]
Removes a serialized key from the map, returning the serialized value at the key if the key was previously in the map.
impl<K, V> LookupMap<K, V> where
K: BorshSerialize,
V: BorshSerialize + BorshDeserialize,
[src]
K: BorshSerialize,
V: BorshSerialize + BorshDeserialize,
pub fn contains_key(&self, key: &K) -> bool
[src]
Returns true if the map contains a given key.
pub fn get(&self, key: &K) -> Option<V>
[src]
Returns the value corresponding to the key.
pub fn remove(&mut self, key: &K) -> Option<V>
[src]
Removes a key from the map, returning the value at the key if the key was previously in the map.
pub fn insert(&mut self, key: &K, value: &V) -> Option<V>
[src]
Inserts a key-value pair into the map.
If the map did not have this key present, None
is returned. Otherwise returns
a value. Note, the keys that have the same hash value are undistinguished by
the implementation.
pub fn extend<IT: IntoIterator<Item = (K, V)>>(&mut self, iter: IT)
[src]
Trait Implementations
impl<K, V> BorshDeserialize for LookupMap<K, V> where
Vec<u8>: BorshDeserialize,
[src]
Vec<u8>: BorshDeserialize,
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
[src]
pub fn try_from_slice(v: &[u8]) -> Result<Self, Error>
[src]
pub fn is_u8() -> bool
[src]
impl<K, V> BorshSerialize for LookupMap<K, V> where
Vec<u8>: BorshSerialize,
[src]
Vec<u8>: BorshSerialize,
Auto Trait Implementations
impl<K, V> RefUnwindSafe for LookupMap<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for LookupMap<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for LookupMap<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
impl<K, V> Unpin for LookupMap<K, V> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for LookupMap<K, V> where
K: UnwindSafe,
V: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,