memchr::arch::all

Function is_prefix

Source
pub fn is_prefix(haystack: &[u8], needle: &[u8]) -> bool
Expand description

Returns true if and only if needle is a prefix of haystack.

This uses a latency optimized variant of memcmp internally which might make this faster for very short strings.

§Inlining

This routine is marked inline(always). If you want to call this function in a way that is not always inlined, you’ll need to wrap a call to it in another function that is marked as inline(never) or just inline.