pub fn collect_stable_map<K, V, M>(iter: Iter<'_, K, V, M>) -> HashMap<K, V>Expand description
Collects entries from a stable BTreeMap iterator into a HashMap<K, V>.
This helper is useful when converting from a stable structure
(like BTreeMap<K, V, M>) to an in-memory HashMap.
§Type Parameters
K: The key type, which must beStorable,Clone,Ord,Eq, andHash.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 HashMap<K, V> containing the collected entries.
§Example (using iter)
let map = collect_stable_map(my_stable_map.iter());§Example (using range)
let range = my_stable_map.range(2..3);
let entries = collect_stable_map(range);