Function chumsky::primitive::seq [−][src]
pub fn seq<I: Clone + PartialEq, Iter: IntoIterator<Item = I>, E>(
xs: Iter
) -> Seq<I, E>
Expand description
A parser that accepts only a sequence of specific tokens.
Examples
use chumsky::prelude::*; let hello = seq::<_, _, Simple<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::<_, _, Simple<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());