std-method
BTreeSet::append
Transfer elements from the other set into this one. Equivalent elements occupy a single place in the combined set; the donor ends empty. Expected stdout (not executed): [1, 3, 5] true Common mistake: Counting equal elements twice after combining.
Formal Syntax & Structure
rust syntaxrust
fn append(&mut self, other: &mut Self)Working Example
Example Snippetrust
fn main() { use std::collections::BTreeSet; let mut a = BTreeSet::from([1, 3]); let mut b = BTreeSet::from([3, 5]); a.append(&mut b); println!("{:?} {}", a.into_iter().collect::<Vec<_>>(), b.is_empty());}