Macro prefix

Source
prefix!() { /* proc-macro */ }
Expand description

Create a Prefix from an ipnet::Ipv4Net string. If you provide an as, you can specify to which type the resulting Ipv4Net will be casted. If you omit the type parameter after as, then the macro will simply invoke .into() on the generated IpvtNet.

// `p` will be an `Ipv4Net`
let p = prefix!("192.168.0.0/24");

// `p` will have type `P`, but `P` must implement `From<Ipv4Net>`.
let p = prefix!("192.168.0.0/24" as P);
let p: P = prefix!("192.168.0.0/24" as);