bparse

Function bytes

Source
pub fn bytes(slice: &[u8]) -> ByteSlice<'_>
Expand description

Returns a pattern that will match slice if it occurs at the start of the input.

use bparse::{Pattern, bytes};

let pattern = bytes(&[1]);
assert_eq!(pattern.eval(&[1, 2, 3]), Some(1));