nonzero: Statically Checked Non-Zero Integers
The crate provides the nonzero! macro that converts an integer to NonZero{Usize,Isize,...} types. The conversion is done statically without extra runtime cost, and rejects zeros in compile-time.
Example
use nonzero as nz;
use ;
let safe_seven: NonZeroUsize = nz!;
let negative_one: NonZeroI32 = nz!;
License
MIT license. See license file.