Struct near_sdk::collections::TreeMap [−][src]
pub struct TreeMap<K, V> { /* fields omitted */ }
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> TreeMap<K, V> where
K: Ord + Clone + BorshSerialize + BorshDeserialize,
V: BorshSerialize + BorshDeserialize,
impl<K, V> TreeMap<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.
Trait Implementations
impl<K, V> BorshDeserialize for TreeMap<K, V> where
u64: BorshDeserialize,
LookupMap<K, V>: BorshDeserialize,
Vector<Node<K>>: BorshDeserialize,
impl<K, V> BorshDeserialize for TreeMap<K, V> where
u64: BorshDeserialize,
LookupMap<K, V>: BorshDeserialize,
Vector<Node<K>>: BorshDeserialize,
Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more
Deserialize this instance from a slice of bytes.
Whether Self is u8.
NOTE: Vec<u8>
is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8>
implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more
impl<K, V> BorshSerialize for TreeMap<K, V> where
u64: BorshSerialize,
LookupMap<K, V>: BorshSerialize,
Vector<Node<K>>: BorshSerialize,
impl<K, V> BorshSerialize for TreeMap<K, V> where
u64: BorshSerialize,
LookupMap<K, V>: BorshSerialize,
Vector<Node<K>>: BorshSerialize,
Serialize this instance into a vector of bytes.
Whether Self is u8.
NOTE: Vec<u8>
is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8>
implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more
impl<'a, K, V> IntoIterator for &'a TreeMap<K, V> where
K: Ord + Clone + BorshSerialize + BorshDeserialize,
V: BorshSerialize + BorshDeserialize,
impl<'a, K, V> IntoIterator for &'a TreeMap<K, V> where
K: Ord + Clone + BorshSerialize + BorshDeserialize,
V: BorshSerialize + BorshDeserialize,
Auto Trait Implementations
impl<K, V> RefUnwindSafe for TreeMap<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> UnwindSafe for TreeMap<K, V> where
K: UnwindSafe,
V: UnwindSafe,