Trait zerovec::ule::AsVarULE[][src]

pub trait AsVarULE {
    type VarULE: VarULE + ?Sized;
    fn as_unaligned(&self) -> &Self::VarULE;
fn from_unaligned(unaligned: &Self::VarULE) -> Self; }
Expand description

A trait for any type that has a 1:1 mapping with an variable-width unaligned little-endian (VarULE) type.

One such type is String, which can be handled as an str, which has no alignment or endianness requirements.

Associated Types

The VarULE type corresponding to Self.

Required methods

Converts from &Self to Self::ULE.

This function will almost always be a Deref or similar.

For best performance, mark your implementation of this function #[inline].

Converts from &Self::ULE to an owned Self.

This function may involve allocation.

For best performance, mark your implementation of this function #[inline].

Safety

This function is infallible because bit validation should have occured when Self::ULE was first constructed. An implementation may therefore involve an unsafe{} block, like from_bytes_unchecked().

Implementations on Foreign Types

Implementors