konst::slice::cmp

Function eq_slice_u8

Source
pub const fn eq_slice_u8(left: &[u8], right: &[u8]) -> bool
Expand description

Compares two &[u8] for equality.

ยงExample

use konst::slice::eq_bytes;

const FOO: &[u8] = b"foo";
const BAR: &[u8] = b"fooooo";
const BAZ: &[u8] = b"bar";


const FOO_EQ_FOO: bool = eq_bytes(FOO, FOO);
assert!( FOO_EQ_FOO );

const FOO_EQ_BAR: bool = eq_bytes(FOO, BAR);
assert!( !FOO_EQ_BAR );

const FOO_EQ_BAZ: bool = eq_bytes(FOO, BAZ);
assert!( !FOO_EQ_BAZ );