Function konst::slice::bytes_strip_prefix[][src]

pub const fn bytes_strip_prefix<'a>(
    left: &'a [u8],
    prefix: &[u8]
) -> Option<&'a [u8]>
Expand description

A const equivalent of <[u8]>::strip_prefix

Example

use konst::slice::bytes_strip_prefix;

assert_eq!(bytes_strip_prefix(b"foo,bar,baz", b"foo,"), Some("bar,baz".as_bytes()));

assert_eq!(bytes_strip_prefix(b"foo,bar,baz", b"bar"), None);
assert_eq!(bytes_strip_prefix(b"foo,bar,baz", b"baz"), None);