pub fn vec_by<T, Predicate, ItemType>(
v: Vec<T>,
predicate: Predicate,
) -> VecEqualByParser<T, Predicate, ItemType>Expand description
Compare the input starts with the given slice. With given equality function.
The closure MUST be Fn(Iterator::Item, &T) -> bool.
This will copy all the characters into std::vec::Vec, so lifetime belongs to the parser itself.
Output: ()
ยงExample
use rusty_parser as rp;
use rp::IntoParser;
let hello_parser = rp::vec_by(vec![104, 101, 108, 108, 111], |value:i32, ch:&i32| value == *ch );