Skip to main content

Zeroable

Trait Zeroable 

Source
pub unsafe trait Zeroable: Copy { }
Expand description

Types for which every-zero bytes form a valid value.

Implementors must guarantee that 0u8 repeated over size_of::<Self>() bytes is a valid initialized value. This is exactly the precondition needed by AlignedVec::calloc.

§Safety

Implementing this trait for a type whose all-zero byte pattern is invalid permits undefined behavior when calloc constructs that type.

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 f32

Source§

impl Zeroable for f64

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 isize

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 Zeroable for usize

Implementors§