konst::slice

Function bytes_contain

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

Whether pattern is inside left.

ยงExample

use konst::slice::bytes_contain;

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

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