Function konst::slice::bytes_end_with

source ·
pub const fn bytes_end_with<const N: usize, P>(left: &[u8], pattern: &P) -> bool
where 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"));