Skip to main content

ZeroCopy

Trait ZeroCopy 

Source
pub unsafe trait ZeroCopy: StaticSize {
    const ALIGN: usize;
}
Available on crate feature zero-copy only.
Expand description

A marker trait indicating that a type has a fixed, predictable layout (e.g., #[repr(C)]) and contains no padding bytes or invalid bit patterns allowing safe zero-copy casting.

§Safety

The type must have a fixed, predictable layout (e.g., #[repr(C)]) and contain no padding bytes or invalid bit patterns allowing safe zero-copy casting.

Required Associated Constants§

Source

const ALIGN: usize

The required alignment for this type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ZeroCopy for bool

Source§

impl ZeroCopy for char

Source§

impl ZeroCopy for f32

Source§

impl ZeroCopy for f64

Source§

impl ZeroCopy for i8

Source§

impl ZeroCopy for i16

Source§

impl ZeroCopy for i32

Source§

impl ZeroCopy for i64

Source§

impl ZeroCopy for i128

Source§

impl ZeroCopy for isize

Source§

impl ZeroCopy for u8

Source§

impl ZeroCopy for u16

Source§

impl ZeroCopy for u32

Source§

impl ZeroCopy for u64

Source§

impl ZeroCopy for u128

Source§

impl ZeroCopy for usize

Source§

impl<T: ZeroCopy, const N: usize> ZeroCopy for [T; N]

Source§

const ALIGN: usize = T::ALIGN

Implementors§

Source§

impl<E: Endian> ZeroCopy for ZeroStr<E>

Source§

impl<T, const ALIGN: usize, E: Endian> ZeroCopy for RelativePtr<T, ALIGN, E>

Source§

impl<T: ZeroCopy, const ALIGN: usize, E: Endian> ZeroCopy for ZeroSlice<T, ALIGN, E>

Source§

impl<T: ZeroCopy, const N: usize, const ALIGN: usize, E: Endian> ZeroCopy for ZeroArray<T, N, ALIGN, E>

Source§

impl<const CAP: usize, E: Endian> ZeroCopy for ZeroString<CAP, E>