Trait core::cmp::bytewise::BytewiseEq

source ·
pub(crate) unsafe trait BytewiseEq<Rhs = Self>: PartialEq<Rhs> + Sized { }
Expand description

Types where == & != are equivalent to comparing their underlying bytes.

Importantly, this means no floating-point types, as those have different byte representations (like -0 and +0) which compare as the same. Since byte arrays are Eq, that implies that these types are probably also Eq, but that’s not technically required to use this trait.

Rhs is de facto always Self, but the separate parameter is important to avoid the specializing impl repeats parameter error when consuming this.

Safety

  • Self and Rhs have no padding.
  • Self and Rhs have the same layout (size and alignment).
  • Neither Self nor Rhs have provenance, so integer comparisons are correct.
  • <Self as PartialEq<Rhs>>::{eq,ne} are equivalent to comparing the bytes.

Implementors§

source§

impl BytewiseEq<Option<NonZeroI8>> for Option<NonZeroI8>

source§

impl BytewiseEq<Option<NonZeroI16>> for Option<NonZeroI16>

source§

impl BytewiseEq<Option<NonZeroI32>> for Option<NonZeroI32>

source§

impl BytewiseEq<Option<NonZeroI64>> for Option<NonZeroI64>

source§

impl BytewiseEq<Option<NonZeroI128>> for Option<NonZeroI128>

source§

impl BytewiseEq<Option<NonZeroIsize>> for Option<NonZeroIsize>

source§

impl BytewiseEq<Option<NonZeroU8>> for Option<NonZeroU8>

source§

impl BytewiseEq<Option<NonZeroU16>> for Option<NonZeroU16>

source§

impl BytewiseEq<Option<NonZeroU32>> for Option<NonZeroU32>

source§

impl BytewiseEq<Option<NonZeroU64>> for Option<NonZeroU64>

source§

impl BytewiseEq<Option<NonZeroU128>> for Option<NonZeroU128>

source§

impl BytewiseEq<Option<NonZeroUsize>> for Option<NonZeroUsize>

source§

impl BytewiseEq<Ordering> for Ordering

source§

impl BytewiseEq<bool> for bool

source§

impl BytewiseEq<char> for char

source§

impl BytewiseEq<i8> for i8

source§

impl BytewiseEq<i16> for i16

source§

impl BytewiseEq<i32> for i32

source§

impl BytewiseEq<i64> for i64

source§

impl BytewiseEq<i128> for i128

source§

impl BytewiseEq<isize> for isize

source§

impl BytewiseEq<u8> for u8

source§

impl BytewiseEq<u16> for u16

source§

impl BytewiseEq<u32> for u32

source§

impl BytewiseEq<u64> for u64

source§

impl BytewiseEq<u128> for u128

source§

impl BytewiseEq<usize> for usize

source§

impl BytewiseEq<NonZeroI8> for NonZeroI8

source§

impl BytewiseEq<NonZeroI16> for NonZeroI16

source§

impl BytewiseEq<NonZeroI32> for NonZeroI32

source§

impl BytewiseEq<NonZeroI64> for NonZeroI64

source§

impl BytewiseEq<NonZeroI128> for NonZeroI128

source§

impl BytewiseEq<NonZeroIsize> for NonZeroIsize

source§

impl BytewiseEq<NonZeroU8> for NonZeroU8

source§

impl BytewiseEq<NonZeroU16> for NonZeroU16

source§

impl BytewiseEq<NonZeroU32> for NonZeroU32

source§

impl BytewiseEq<NonZeroU64> for NonZeroU64

source§

impl BytewiseEq<NonZeroU128> for NonZeroU128

source§

impl BytewiseEq<NonZeroUsize> for NonZeroUsize

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 0]> for [T; 0]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 1]> for [T; 1]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 2]> for [T; 2]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 3]> for [T; 3]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 4]> for [T; 4]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 6]> for [T; 6]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 8]> for [T; 8]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 12]> for [T; 12]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 16]> for [T; 16]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 24]> for [T; 24]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 32]> for [T; 32]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 48]> for [T; 48]

source§

impl<T: BytewiseEq<U>, U> BytewiseEq<[U; 64]> for [T; 64]