pub const fn bytes_start_with<const N: usize, P>(
left: &[u8],
pattern: &P,
) -> boolwhere
P: ?Sized + BytesPattern<N>,
Expand description
Whether pattern
is the start of left
.
This is analogous to
<[u8]>::starts_with
ยงExample
use konst::slice::bytes_start_with;
assert!( bytes_start_with(b"foo,bar,baz", "foo,"));
assert!( bytes_start_with(b"foo,bar,baz", &'f'));
assert!( bytes_start_with(b"foo,bar,baz", &[b'f', b'o', b'o']));
assert!(!bytes_start_with(b"foo,bar,baz", "bar"));
assert!(!bytes_start_with(b"foo,bar,baz", "baz"));