pub type NonZeroI8 = NonZero<i8>;Expand description
An i8 that is known not to equal zero.
This enables some memory layout optimization.
For example, Option<NonZeroI8> is the same size as i8:
§Layout
NonZeroI8 is guaranteed to have the same layout and bit validity as i8
with the exception that 0 is not a valid instance.
Option<NonZeroI8> is guaranteed to be compatible with i8,
including in FFI.
Thanks to the null pointer optimization,
NonZeroI8 and Option<NonZeroI8>
are guaranteed to have the same size and alignment:
Aliased Type§
pub struct NonZeroI8(/* private fields */);