Function konst::slice::eq_bytes

source ·
pub const fn eq_bytes(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 );