Function chumsky::primitive::seq

source ·
pub fn seq<I: Clone + PartialEq, Iter: IntoIterator<Item = I>, E>(
    xs: Iter
) -> Seq<I, E>
👎Deprecated since 0.7.0: Use just instead: it now works for many sequence-like types!
Expand description

A parser that accepts only a sequence of specific inputs.

The output type of this parser is ().

Examples

let hello = seq::<_, _, Cheap<char>>("Hello".chars());

assert_eq!(hello.parse("Hello"), Ok(()));
assert_eq!(hello.parse("Hello, world!"), Ok(()));
assert!(hello.parse("Goodbye").is_err());

let onetwothree = seq::<_, _, Cheap<i32>>([1, 2, 3]);

assert_eq!(onetwothree.parse([1, 2, 3]), Ok(()));
assert_eq!(onetwothree.parse([1, 2, 3, 4, 5]), Ok(()));
assert!(onetwothree.parse([2, 1, 3]).is_err());