macro_rules! call {
($($args:tt)*) => { ... };
}Expand description
Generates a closure that calls a function with a tuple’s contents as it arguments. The input can be anything as long as the last token contains all the arguments parenthesized.
use shrimple_parser::{Parser, pattern::parse_until_ex, call};
fn len_sum(a: &str, b: &str) -> usize {
a.len() + b.len()
}
let input = "abc|def|";
let res = parse_until_ex::<_, ()>("|")
.and(parse_until_ex("|"))
.map_out(call!(len_sum(a, b)))
.parse(input);
assert_eq!(res, Ok(("", 6)))