Macro constmuck::IsZeroable [−][src]
macro_rules! IsZeroable {
() => { ... };
($T : ty) => { ... };
}
Expand description
Constructs an IsZeroable<$T>
,
requires $T:
Zeroable
.
This has an optional type argument ($T
) that defaults to
infering the type if not passed.
This macro is defined for completeness’ sake,
no function in this crate takes IsZeroable
by itself,
always a TypeSize<T, IsZeroable<T>, _>
,
which can be constructed with the
TypeSize
macro.
Related: the copying
module
Example
use constmuck::{IsZeroable, TypeSize};
const FOO: IsZeroable<u32> = IsZeroable!();
assert_eq!(constmuck::zeroed(TypeSize!(u32).with_bounds(FOO)), 0u32);
// alternatively, the typical way to call `constmuck::zeroed`.
assert_eq!(constmuck::zeroed(TypeSize!(u32)), 0u32);
const BAR: IsZeroable<u8> = IsZeroable!(u8);
assert_eq!(constmuck::zeroed_array(TypeSize!(u8).with_bounds(BAR)), [0u8; 4]);
// alternatively, the typical way to call `constmuck::zeroed_array`.
assert_eq!(constmuck::zeroed_array(TypeSize!(u8)), [0u8; 4]);