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§
pub use super::ZeroVecError;
Modules§
- chars 🔒
- ULE implementation for the
chartype. - custom
- Documentation on implementing custom VarULE types.
- encode 🔒
- macros 🔒
- multi 🔒
- niche 🔒
- option 🔒
- plain 🔒
- ULE implementation for Plain Old Data types, including all sized integers.
- slices 🔒
- tuple
- ULE impls for tuples.
- unvalidated 🔒
Structs§
- CharULE
- A u8 array of little-endian data corresponding to a Unicode scalar value.
- Multi
FieldsULE - This type is used by the custom derive to represent multiple
VarULEfields packed into a single end-of-struct field. It is not recommended to use this type directly. - Niched
Option - Optional type which uses
NichedOptionULE<U,N>as ULE type. The implementors guarantee thatN == core::mem::sizeo_of::<Self>()[repr(transparent)] guarantees that the layout is same asOption<U> - OptionULE
- This type is the
ULEtype forOption<U>whereUis aULEtype - Option
VarULE - A type allowing one to represent
Option<U>forVarULEUtypes. - RawBytesULE
- A u8 array of little-endian data with infallible conversions to and from &u8.
- Unvalidated
Char - A u8 array of little-endian data that is expected to be a Unicode scalar value, but is not validated as such.
- Unvalidated
Str - A byte slice that is expected to be a UTF-8 string but does not enforce that invariant.
Traits§
- AsULE
- A trait for any type that has a 1:1 mapping with an unaligned little-endian (ULE) type.
- Encode
AsVarULE - 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.
- EqULE
- An
EqULEtype is one whose byte sequence equals the byte sequence of its ULE type on little-endian platforms. This enables certain performance optimizations, such asZeroVec::try_from_slice. - Niche
Bytes - The
ULEtypes implementing this trait guarantee thatNicheBytes::NICHE_BIT_PATTERNcan never occur as a valid byte representation of the type. - Slice
AsULE - A trait for a type where aligned slices can be cast to unaligned slices.
- ULE
- Fixed-width, byte-aligned data that can be cast to and from a little-endian byte slice.
- VarULE
- Variable-width, byte-aligned data that can be cast to and from a little-endian byte slice.
Functions§
- encode_
varule_ to_ box - Given an
EncodeAsVarULEtypeS, encode it into aBox<T>
Unions§
- Niched
OptionULE ULEtype forNichedOption<U,N>where U implementsNicheBytes. The invalid bit pattern is used as the niche.