This crate provides set!
macros to create set collections and
insert elements. This is inspired by the vec!
macro.
Create a new set collection and insert elements.
Example with tuple syntax:
let m = set!((1, 2), (3, 4));
Example with arrow syntax:
let m = set!(1 => 2, 3 => 4);
Equivalent Rust standard code:
let mut m = HashSet::new();
m.insert(1, 2);
m.insert(3, 4);
Use an existing set collection and insert elements.
Example with tuple syntax:
let mut m = HashSet::new();
set_insert!(m, (1, 2), (3, 4));
Example with arrow syntax:
let mut m = HashSet::new();
set_insert!(m, 1 => 2, 3 => 4);
Equivalent Rust std code with method `insert``:
let mut m = HashSet::new();
m.insert(1, 2);
m.insert(3, 4);