Skip to main content

Zeroable

Trait Zeroable 

Source
pub unsafe trait Zeroable: Sized + Copy { }
Expand description

Marker for Copy + Sized values that are valid for every bit pattern.

§Safety

This is the by-value contract: a Zeroable value can be produced by copying size_of::<T>() arbitrary bytes (e.g. a zero fill, or an unaligned read_unaligned). It says nothing about alignment, so it holds for native multi-byte integers as well. To overlay a type as &T / &mut T directly on account bytes, which requires alignment 1, use Pod (and, at the framework level, hopper_runtime::ZeroCopy).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Zeroable for ()

Source§

impl Zeroable for i8

Source§

impl Zeroable for i16

Source§

impl Zeroable for i32

Source§

impl Zeroable for i64

Source§

impl Zeroable for i128

Source§

impl Zeroable for u8

Source§

impl Zeroable for u16

Source§

impl Zeroable for u32

Source§

impl Zeroable for u64

Source§

impl Zeroable for u128

Source§

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

Implementors§