Prse
Prse is a small string parsing library with an emphasis on speed and ease of use. (It's also no-std compatible!)
It provides the parse! macro which allows you to easily parse strings into any type using a format args like syntax.
Prse currently supports rustc 1.59 and above.
Examples
use parse;
let input = "5 + -2 = 3";
let total: i32;
let : = parse!;
assert_eq!;
It also allows you to parse into multiple variables separated by a separator in a single go.
use parse;
let input = "My farm contains some amount of booleans: true || false || true || false";
let many: ;
// the variable to store the answer in is many and the separator is equal to " || "
parse!;
assert_eq!;
You can use the try_parse! macro if you don't want to panic when the parsing fails.
use try_parse;
use PathBuf;
let input = "cd C:\\windows\\system32";
let path: = try_parse!;
assert_eq!;
Additionally you can use the Parse derive macro to help you parse custom types.
use ;
let input = "(1, 3) + (-2, 9)";
let : = parse!;
assert_eq!;
assert_eq!;