try_parse

Macro try_parse 

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

Returns a Result instead of unwrapping like parse!. The Result has ParseError as the error type.

For more information please look at parse!.

let input = "cd C:\\windows\\system32";
let path: Result<PathBuf, _> = try_parse!(input, "cd {}");

assert_eq!(path.unwrap(), PathBuf::from("C:\\windows\\system32"));