pub struct ComparableArray<'a, T, const N: usize>where
T: PartialEq,{ /* private fields */ }
Expand description
Comparable array of variables.
This can be used when manually calling is_buffer_equal
to compare two arrays
is to be avoided.
Using ComparableArray over is_buffer_equal
is generally preferred, since
it is more readable.
§Example
const A: &[u8; 14] = b"same same same";
const B: &[u8; 14] = b"same same same";
const COMPARABLE_A: ComparableArray<u8, 14> = ComparableArray::new(A);
const COMPARABLE_B: ComparableArray<u8, 14> = ComparableArray::new(B);
if COMPARABLE_A != COMPARABLE_B {
rollback(b"arrays are not the same", -1);
}
Implementations§
Trait Implementations§
Source§impl<'a, T, const N: usize> From<&'a [T; N]> for ComparableArray<'a, T, N>where
T: PartialEq,
impl<'a, T, const N: usize> From<&'a [T; N]> for ComparableArray<'a, T, N>where
T: PartialEq,
Auto Trait Implementations§
impl<'a, T, const N: usize> Freeze for ComparableArray<'a, T, N>
impl<'a, T, const N: usize> RefUnwindSafe for ComparableArray<'a, T, N>where
T: RefUnwindSafe,
impl<'a, T, const N: usize> Send for ComparableArray<'a, T, N>where
T: Sync,
impl<'a, T, const N: usize> Sync for ComparableArray<'a, T, N>where
T: Sync,
impl<'a, T, const N: usize> Unpin for ComparableArray<'a, T, N>
impl<'a, T, const N: usize> UnwindSafe for ComparableArray<'a, T, N>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more