The From<NonZeroU32> for Error implementation doesn't do any checking of its inputs; for example, it doesn't verify that an "internal" error code isn't being used, nor does it verify that any internal error code is actually a valid/known one.
I propose:
This way, internal errors will eventually only be able to be constructed from within the crate.
The
From<NonZeroU32> for Errorimplementation doesn't do any checking of its inputs; for example, it doesn't verify that an "internal" error code isn't being used, nor does it verify that any internal error code is actually a valid/known one.I propose:
pub const fn Error::new_custom(value: u16) -> Errorpub const fn Error::new_os(u32) -> Errorwith range checking, as done in Enforce OS errors are in the allowed range. #441, though Enforce OS errors are in the allowed range. #441 doesn't make itpub.impl From<NonZeroU32> for Erroras#[deprecated]now.This way, internal errors will eventually only be able to be constructed from within the crate.