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