Trait zerovec::ule::niche::NicheBytes

source ·
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.

  1. N must be equal to core::mem::sizeo_of::<Self>() or else it will cause panics.
  2. The bit pattern NicheBytes::NICHE_BIT_PATTERN must not be incorrect as it would lead to weird behaviour.
  3. The abstractions built on top of this trait must panic on an invalid N.
  4. The abstractions built on this trait that use type punning must ensure that type being punned is ULE.

Required Associated Constants§

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl NicheBytes<1> for NonZeroU8

Implementors§