pub fn collect_stable_vec<K, V, M>(iter: Iter<'_, K, V, M>) -> Vec<(K, V)>Expand description
Collects entries from a stable BTreeMap iterator into a Vec<(K, V)>.
This is useful when working with ic-stable-structures’s BTreeMap
and you want to extract all entries as a vector of key-value pairs.
§Type Parameters
K: The key type, which must beStorable,Clone, andOrd.V: The value type, which must beStorableandClone.M: The memory backend, which must implement theMemorytrait.
§Arguments
iter: An iterator over the entries of a stableBTreeMap.
§Returns
A vector containing (K, V) pairs.
§Example (using iter)
let vec = collect_stable_vec(my_stable_map.iter());§Example (using range)
let range = my_stable_map.range(2..3);
let entries = collect_stable_vec(range);