Macro const_zero::const_zero[][src]

macro_rules! const_zero {
    ($type_:ty) => { ... };
}

A marco that acts similarly to std::mem::zeroed(), only is const Example usage:

use const_zero::const_zero;
struct OpaqueStruct {
    nothing: core::ffi::c_void,
};
static mut zeroed_opaque: OpaqueStruct = unsafe {const_zero!(OpaqueStruct)};

Ideally const_zero would be a generic function, but const generics need more development first (const_fn_transmute, const_generics, const_evaluatable_checked)

Differences with std::mem::zeroed

const_zero zeroes padding bits, while std::mem::zeroed doesn’t