pub const fn u8_slice_eq(left: &[u8], right: &[u8]) -> bool
Available on crate feature fmt only.
Expand description

A const equivalent of &[u8] equality comparison.

Example

use const_format::utils::u8_slice_eq;

const SLICES: &[&[u8]] = &[
    &[10, 20],
    &[10, 20, 30, 40],
    &[3, 5, 8, 13],
    &[4, 9, 16, 25],
];

const ARE_0_0_EQ: bool = u8_slice_eq(SLICES[0], SLICES[0]);
const ARE_0_1_EQ: bool = u8_slice_eq(SLICES[0], SLICES[1]);

const ARE_1_1_EQ: bool = u8_slice_eq(SLICES[1], SLICES[1]);
const ARE_1_2_EQ: bool = u8_slice_eq(SLICES[1], SLICES[2]);

const ARE_2_2_EQ: bool = u8_slice_eq(SLICES[2], SLICES[2]);
const ARE_2_3_EQ: bool = u8_slice_eq(SLICES[2], SLICES[3]);

assert!(  ARE_0_0_EQ );
assert!( !ARE_0_1_EQ );

assert!(  ARE_1_1_EQ );
assert!( !ARE_1_2_EQ );

assert!(  ARE_2_2_EQ );
assert!( !ARE_2_3_EQ );