Skip to main content

hash_set

Macro hash_set 

Source
macro_rules! hash_set {
    () => { ... };
    ($($v:expr),+ $(,)?) => { ... };
}
Available on crate features test only.
Expand description

Test helper to create a HashSet with values that support FromStr

ยงExamples

use std::collections::HashSet;
use std::net::IpAddr;
use nix_compat::hash_set;

let mut m : HashSet<IpAddr> = HashSet::new();
m.insert("127.0.0.1".parse().unwrap());
m.insert("192.168.1.1".parse().unwrap());

let m2 : HashSet<IpAddr> = hash_set![
    "127.0.0.1",
    "192.168.1.1",
];
assert_eq!(m, m2);