NonZero::<T>::from_str
is already implemented. This only supports decimal, just like integer_type::from_str
.
For example, to convert a string which represents a hexadecimal number, we need to do something like this:
let n = NonZeroU8::new(u8::from_str_radix("ff", 16)?).unwrap();
I think it would be useful to be able to write this to something like this:
let n = NonZeroU8::from_str_radix("ff", 16).unwrap();
Also, unlike the first example, I think this example can return IntErrorKind::Zero
.