[][src]Macro iocutil::sample

macro_rules! sample {
    ($hash:literal) => { ... };
    ($hash:literal => sha256) => { ... };
    ($hash:literal => sha1) => { ... };
    ($hash:literal => md5) => { ... };
}

Example

use iocutil::prelude::*;
let s1 = sample!("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
assert_eq!(s1, SampleHash::Sha256("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855".to_string()));

// with hash type check
let s2 = sample!("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" => sha256);
assert_eq!(s1, s2);
use iocutil::prelude::*;
// panic if it is not hash
sample!("a");
use iocutil::prelude::*;
// panic if hash type does not match
let s3 = sample!("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" => md5); // panic