Struct everscale_types::dict::Dict
source · pub struct Dict<C: CellFamily, K, V> { /* private fields */ }Expand description
Typed dictionary with fixed length keys.
Implementations§
source§impl<C: CellFamily, K, V> Dict<C, K, V>
impl<C: CellFamily, K, V> Dict<C, K, V>
source§impl<C, K, V> Dict<C, K, V>where
for<'c> C: CellFamily + 'c,
K: DictKey,
impl<C, K, V> Dict<C, K, V>where for<'c> C: CellFamily + 'c, K: DictKey,
sourcepub fn load_from_root_ext(
slice: &mut CellSlice<'_, C>,
finalizer: &mut dyn Finalizer<C>
) -> Option<Self>
pub fn load_from_root_ext( slice: &mut CellSlice<'_, C>, finalizer: &mut dyn Finalizer<C> ) -> Option<Self>
Loads a non-empty dictionary from a root cell.
source§impl<C, K, V> Dict<C, K, V>where
for<'c> C: DefaultFinalizer + 'c,
K: Store<C> + DictKey,
impl<C, K, V> Dict<C, K, V>where for<'c> C: DefaultFinalizer + 'c, K: Store<C> + DictKey,
source§impl<C, K, V> Dict<C, K, V>where
for<'c> C: DefaultFinalizer + 'c,
K: Store<C> + DictKey,
V: Store<C>,
impl<C, K, V> Dict<C, K, V>where for<'c> C: DefaultFinalizer + 'c, K: Store<C> + DictKey, V: Store<C>,
sourcepub fn set<Q, T>(&mut self, key: Q, value: T) -> Result<(), Error>where
Q: Borrow<K>,
T: Borrow<V>,
pub fn set<Q, T>(&mut self, key: Q, value: T) -> Result<(), Error>where Q: Borrow<K>, T: Borrow<V>,
Sets the value associated with the key in the dictionary.
Use set_ext if you need to use a custom finalizer.
source§impl<C: CellFamily, K, V> Dict<C, K, V>where
K: Store<C> + DictKey,
impl<C: CellFamily, K, V> Dict<C, K, V>where K: Store<C> + DictKey,
sourcepub fn iter<'a>(&'a self) -> Iter<'_, C, K, V> ⓘwhere
V: Load<'a, C>,
pub fn iter<'a>(&'a self) -> Iter<'_, C, K, V> ⓘwhere V: Load<'a, C>,
Gets an iterator over the entries of the dictionary, sorted by key.
The iterator element type is Result<(K, V)>.
If the dictionary is invalid, finishes after the first invalid element, returning an error.
Performance
In the current implementation, iterating over dictionary builds a key
for each element. Use values or raw_values if you don’t need keys from an iterator.
sourcepub fn keys(&self) -> Keys<'_, C, K> ⓘ
pub fn keys(&self) -> Keys<'_, C, K> ⓘ
Gets an iterator over the keys of the dictionary, in sorted order.
The iterator element type is Result<K>.
If the dictionary is invalid, finishes after the first invalid element, returning an error.
Performance
In the current implementation, iterating over dictionary builds a key
for each element. Use values if you don’t need keys from an iterator.
source§impl<C, K, V> Dict<C, K, V>where
for<'c> C: DefaultFinalizer + 'c,
K: DictKey,
impl<C, K, V> Dict<C, K, V>where for<'c> C: DefaultFinalizer + 'c, K: DictKey,
source§impl<C, K, V> Dict<C, K, V>where
for<'c> C: CellFamily + 'c,
K: Store<C> + DictKey,
impl<C, K, V> Dict<C, K, V>where for<'c> C: CellFamily + 'c, K: Store<C> + DictKey,
sourcepub fn get_ext<'a: 'b, 'b, Q>(
&'a self,
key: Q,
finalizer: &mut dyn Finalizer<C>
) -> Result<Option<V>, Error>where
Q: Borrow<K> + 'b,
V: Load<'a, C>,
pub fn get_ext<'a: 'b, 'b, Q>( &'a self, key: Q, finalizer: &mut dyn Finalizer<C> ) -> Result<Option<V>, Error>where Q: Borrow<K> + 'b, V: Load<'a, C>,
Returns the value corresponding to the key.
Key is serialized using the provided finalizer.
sourcepub fn get_raw_ext<'a: 'b, 'b, Q>(
&'a self,
key: Q,
finalizer: &mut dyn Finalizer<C>
) -> Result<Option<CellSlice<'a, C>>, Error>where
Q: Borrow<K> + 'b,
pub fn get_raw_ext<'a: 'b, 'b, Q>( &'a self, key: Q, finalizer: &mut dyn Finalizer<C> ) -> Result<Option<CellSlice<'a, C>>, Error>where Q: Borrow<K> + 'b,
Returns the value corresponding to the key.
Key is serialized using the provided finalizer.
sourcepub fn raw_iter(&self) -> RawIter<'_, C> ⓘ
pub fn raw_iter(&self) -> RawIter<'_, C> ⓘ
Gets an iterator over the raw entries of the dictionary, sorted by key.
The iterator element type is Result<(CellBuilder<C>, CellSlice<C>)>.
If the dictionary is invalid, finishes after the first invalid element, returning an error.
Performance
In the current implementation, iterating over dictionary builds a key
for each element. Use values or raw_values if you don’t need keys from an iterator.
sourcepub fn raw_keys(&self) -> RawKeys<'_, C> ⓘ
pub fn raw_keys(&self) -> RawKeys<'_, C> ⓘ
Gets an iterator over the raw keys of the dictionary, in sorted order.
The iterator element type is Result<CellBuilder<C>>.
If the dictionary is invalid, finishes after the first invalid element, returning an error.
Performance
In the current implementation, iterating over dictionary builds a key
for each element. Use values or raw_values if you don’t need keys from an iterator.
source§impl<C, K, V> Dict<C, K, V>where
for<'c> C: CellFamily + 'c,
K: DictKey,
impl<C, K, V> Dict<C, K, V>where for<'c> C: CellFamily + 'c, K: DictKey,
sourcepub fn raw_values(&self) -> RawValues<'_, C> ⓘ
pub fn raw_values(&self) -> RawValues<'_, C> ⓘ
Gets an iterator over the raw values of the dictionary, in order by key.
The iterator element type is Result<CellSlice<C>>.
If the dictionary is invalid, finishes after the first invalid element, returning an error.
source§impl<C, K, V> Dict<C, K, V>where
for<'c> C: CellFamily + 'c,
K: Store<C> + DictKey,
V: Store<C>,
impl<C, K, V> Dict<C, K, V>where for<'c> C: CellFamily + 'c, K: Store<C> + DictKey, V: Store<C>,
sourcepub fn set_ext<Q, T>(
&mut self,
key: Q,
value: T,
finalizer: &mut dyn Finalizer<C>
) -> Result<(), Error>where
Q: Borrow<K>,
T: Borrow<V>,
pub fn set_ext<Q, T>( &mut self, key: Q, value: T, finalizer: &mut dyn Finalizer<C> ) -> Result<(), Error>where Q: Borrow<K>, T: Borrow<V>,
Sets the value associated with the key in the dictionary.