Crate packed

Source
Expand description

A safe approach to using #[repr(packed)] data.

See nue_macros for the automagic #[packed] attribute.

Traits§

Aligned
A trait for converting types with alignments greater than 1 into their unaligned equivalent.
Packed
A marker trait indicating that a type is #[repr(packed)].
Unaligned
A marker trait indicating that a type has an alignment of 1.

Functions§

is_aligned_for
Determines whether a pointer or reference is correctly aligned for type T.
is_aligned_for_slice
Determines whether a slice is correctly aligned for type T.
size_of_slice
Calculates the total byte size of a slice.

Type Aliases§

Un
A type alias that represents the unaligned type of T.