Function i_dunno::encode_all[][src]

pub fn encode_all(
    ip_addr: IpAddr,
    required_confusion_level: ConfusionLevel
) -> impl Iterator<Item = String>

Provide valid I-DUNNO encodings for the supplied IP address at the given confusion level.

The output of this function should not be presented to humans, since seeing multiple encodings may trigger an undesirable confusion reduction.

Examples

use i_dunno::{encode_all, ConfusionLevel};
let a: Vec<String> = encode_all(
    "::16:164".parse().unwrap(),
    ConfusionLevel::Minimum
).collect();
assert_eq!(
    a,
    vec![
        "\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{2c02}d"
    ]
);

let b = encode_all(
    "198.51.100.164".parse().unwrap(),
    ConfusionLevel::Minimum
).next().unwrap();
assert_eq!(b, "c\u{c}l\u{04A4}");