1 2 3 4 5 6 7 8 9 10
use std::num::NonZeroU32; pub type ImplType = NonZeroU32; pub unsafe fn from_u32_unchecked(x: u32) -> ImplType { unsafe { NonZeroU32::new_unchecked(x.unchecked_add(1)) } } pub fn to_u32(i: ImplType) -> u32 { i.get().wrapping_sub(1) }