Function utils::parser::constant

source ·
pub fn constant<T: Copy>(v: T) -> Constant<T>
Expand description

Parser that consumes no input and always succeeds, returning the provided value.

§Examples

assert_eq!(
    parser::constant(1).parse(b"abc"),
    Ok((1, &b"abc"[..]))
);