Feature gate: #![feature(btree_merge)]
This is a tracking issue for rust-lang/libs-team#739
It adds a method similar to BTreeMap::append with merging two BTreeMaps in O(n + m) complexity, but allows the user to specify a callback function to handle what the resulting value should be for conflicting keys.
Public API
// use std::collections::BTreeMap; or use alloc::collections::btree_map;
impl <K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
pub fn merge(&mut self, other: BTreeMap<K, V, A>, conflict: impl FnMut(&K, V, V) -> V) { ... }
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
Unresolved Questions
Feature gate:
#![feature(btree_merge)]This is a tracking issue for rust-lang/libs-team#739
It adds a method similar to
BTreeMap::appendwith merging twoBTreeMaps inO(n + m)complexity, but allows the user to specify a callback function to handle what the resulting value should be for conflicting keys.Public API
Steps / History
(Remember to update the
S-tracking-*label when checking boxes.)BTreeMap::append_withlibs-team#739BTreeMap::mergeoptimized #152418BTreeMap::merge#153040Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩