Struct everscale_types::dict::Dict

source ·
pub struct Dict<C: CellFamily, const N: u16>(_);
Expand description

Dictionary with fixed length keys (where N is a number of bits in each key).

TLB scheme

// ordinary Hashmap / HashmapE, with fixed length keys

hm_edge#_ {n:#} {X:Type} {l:#} {m:#} label:(HmLabel ~l n)
          {n = (~m) + l} node:(HashmapNode m X) = Hashmap n X;

hmn_leaf#_ {X:Type} value:X = HashmapNode 0 X;
hmn_fork#_ {n:#} {X:Type} left:^(Hashmap n X)
           right:^(Hashmap n X) = HashmapNode (n + 1) X;

hml_short$0 {m:#} {n:#} len:(Unary ~n) {n <= m} s:(n * Bit) = HmLabel ~n m;
hml_long$10 {m:#} n:(#<= m) s:(n * Bit) = HmLabel ~n m;
hml_same$11 {m:#} v:Bit n:(#<= m) = HmLabel ~n m;

hme_empty$0 {n:#} {X:Type} = HashmapE n X;
hme_root$1 {n:#} {X:Type} root:^(Hashmap n X) = HashmapE n X;

unary_zero$0 = Unary ~0;
unary_succ$1 {n:#} x:(Unary ~n) = Unary ~(n + 1);

bit$_ (## 1) = Bit;

Implementations§

Creates an empty dictionary.

Returns true if the dictionary contains no elements.

Returns a CellSlice of the value corresponding to the key.

Returns true if the dictionary contains a value for the specified key.

Sets the value associated with the key in the dictionary.

Sets the value associated with the key in the dictionary only if the key was already present in it.

Sets the value associated with key in dictionary, but only if it is not already present.

Gets an iterator over the 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 if you don’t need keys from an iterator.

Gets an iterator over the 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 if you don’t need keys from an iterator.

Gets an iterator over the 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.

Sets the value associated with the key in the dictionary.

Use set_ext if you need to use a custom finalizer.

Sets the value associated with the key in the dictionary only if the key was already present in it.

Use replace_ext if you need to use a custom finalizer.

Sets the value associated with key in dictionary, but only if it is not already present.

Use add_ext if you need to use a custom finalizer.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.