Macro strp::scan

source ·
scan!() { /* proc-macro */ }
Expand description

Interally uses try_scan and unwraps the result to parse multiple values from a source string.

For more details read the documentation of the strp crate.

let source = "10, 20, 30, 40";
let matched = scan!(source => "{}, {}, {}, {}");
assert_eq!(matched, (10, 20, 30, 40));

// Uses stdin as source.
let (l, r): (u32, u32) = scan!("add {}, {}");
println!("result: {}", l + r)