pub const fn bytes_end_with<const N: usize, P>(left: &[u8], pattern: &P) -> boolwhere
P: ?Sized + BytesPattern<N>,
Expand description
Whether pattern
is the end of left
.
A const analog of
<[u8]>::ends_with
ยงExample
use konst::slice::bytes_end_with;
assert!( bytes_end_with(b"foo,bar,baz", b",baz"));
assert!( bytes_end_with(b"foo,bar,baz", "bar,baz"));
assert!( bytes_end_with(b"foo,bar,baz", &'z'));
assert!(!bytes_end_with(b"foo,bar,baz", b"bar"));
assert!(!bytes_end_with(b"foo,bar,baz", b"foo"));