Module zerovec::ule

source ·
Expand description

Traits over unaligned little-endian data (ULE, pronounced “yule”).

The main traits for this module are ULE, AsULE and, VarULE.

See the design doc for details on how these traits works under the hood.

Re-exports§

Modules§

  • Documentation on implementing custom VarULE types.
  • ULE impls for tuples.

Structs§

  • A u8 array of little-endian data corresponding to a Unicode scalar value.
  • This type is used by the custom derive to represent multiple VarULE fields packed into a single end-of-struct field. It is not recommended to use this type directly.
  • Optional type which uses NichedOptionULE<U,N> as ULE type. The implementors guarantee that N == core::mem::sizeo_of::<Self>() [repr(transparent)] guarantees that the layout is same as Option<U>
  • This type is the ULE type for Option<U> where U is a ULE type
  • A type allowing one to represent Option<U> for VarULE U types.
  • A u8 array of little-endian data with infallible conversions to and from &u8.
  • A u8 array of little-endian data that is expected to be a Unicode scalar value, but is not validated as such.
  • A byte slice that is expected to be a UTF-8 string but does not enforce that invariant.

Traits§

  • A trait for any type that has a 1:1 mapping with an unaligned little-endian (ULE) type.
  • Allows types to be encoded as VarULEs. This is highly useful for implementing VarULE on custom DSTs where the type cannot be obtained as a reference to some other type.
  • An EqULE type is one whose byte sequence equals the byte sequence of its ULE type on little-endian platforms. This enables certain performance optimizations, such as ZeroVec::try_from_slice.
  • The ULE types implementing this trait guarantee that NicheBytes::NICHE_BIT_PATTERN can never occur as a valid byte representation of the type.
  • A trait for a type where aligned slices can be cast to unaligned slices.
  • Fixed-width, byte-aligned data that can be cast to and from a little-endian byte slice.
  • Variable-width, byte-aligned data that can be cast to and from a little-endian byte slice.

Functions§

Unions§

Derive Macros§