pub trait NicheBytes<const N: usize> {
const NICHE_BIT_PATTERN: [u8; N];
}
Expand description
The ULE
types implementing this trait guarantee that NicheBytes::NICHE_BIT_PATTERN
can never occur as a valid byte representation of the type.
Guarantees for a valid implementation.
- N must be equal to
core::mem::sizeo_of::<Self>()
or else it will cause panics. - The bit pattern
NicheBytes::NICHE_BIT_PATTERN
must not be incorrect as it would lead to weird behaviour. - The abstractions built on top of this trait must panic on an invalid N.
- The abstractions built on this trait that use type punning must ensure that type being
punned is
ULE
.
Required Associated Constants§
const NICHE_BIT_PATTERN: [u8; N]
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.