tag

Function tag 

Source
pub fn tag<S, A>(expected: S) -> Tag<S, A>
Expand description

Match an exact sequence.

  • On success: consumes the whole sequence and returns ().
  • On failure: pushes an Unexpected error at the mismatch location.

This does not cut by itself.

ยงExamples

use chasa::prelude::*;

let mut input = "hello!";
let out = parse_ok_once(&mut input, tag("hello")).unwrap();
assert_eq!(out, ());
assert_eq!(input, "!");