konst::slice

Function bytes_rcontain

Source
pub const fn bytes_rcontain<const N: usize, P>(left: &[u8], pattern: &P) -> bool
where P: ?Sized + BytesPattern<N>,
Expand description

Returns whether pattern is contained inside left, searching in reverse.

ยงExample

use konst::slice::bytes_rcontain;

assert!(bytes_rcontain(b"foo-bar", b"foo"));
assert!(bytes_rcontain(b"bar-foo", "foo"));

assert!(!bytes_rcontain(b"foo-bar-baz", &'q'));