macro_rules! set {
{} => { ... };
{ owned: $($value:expr_2021),+ $(,)? } => { ... };
{ $($value:expr_2021),+ $(,)? } => { ... };
}Available on crate features
alloc and std only.Expand description
Creates a HashSet from values. Available with the std feature.
Repeated values are stored once. The owned: form calls to_owned() on
each value.
use collections::set;
assert_eq!(set![1, 2, 3, 1], set![1, 2, 3]);
let owned = set! { owned: "one", "two" };
assert!(owned.contains("one"));