Struct near_sdk::collections::LegacyTreeMap
source · [−]pub struct LegacyTreeMap<K, V> { /* private fields */ }
Expand description
TreeMap based on AVL-tree
Runtime complexity (worst case):
get
/contains_key
: O(1) - UnorderedMap lookupinsert
/remove
: O(log(N))min
/max
: O(log(N))above
/below
: O(log(N))range
of K elements: O(Klog(N))
Implementations
impl<K, V> LegacyTreeMap<K, V> where
K: Ord + Clone + BorshSerialize + BorshDeserialize,
V: BorshSerialize + BorshDeserialize,
impl<K, V> LegacyTreeMap<K, V> where
K: Ord + Clone + BorshSerialize + BorshDeserialize,
V: BorshSerialize + BorshDeserialize,
Returns the smallest key that is strictly greater than key given as the parameter
Returns the largest key that is strictly less than key given as the parameter
Returns the smallest key that is greater or equal to key given as the parameter
Returns the largest key that is less or equal to key given as the parameter
Iterate all entries in ascending order: min to max, both inclusive
Iterate entries in ascending order: given key (exclusive) to max (inclusive)
Iterate all entries in descending order: max to min, both inclusive
Iterate entries in descending order: given key (exclusive) to min (inclusive)
Iterate entries in ascending order according to specified bounds.
Panics
Panics if range start > end. Panics if range start == end and both bounds are Excluded.
Helper function which creates a [Vec<(K, V)>
] of all items in the LegacyTreeMap
.
This function collects elements from LegacyTreeMap::iter
.