As it stands, is_empty() is redundant for NonEmptyBz, and the method len() should return NonZeroUsize.
Proposal
Remove NonEmptyBz::is_empty and modify NonEmptyBz::len as follows:
impl<T> NonEmptyBz<T> {
pub fn len(&self) -> NonZeroUsize
where
T: AsRef<[u8]>;
}
Breaking
This is a breaking change, thus should bump the version from 0.1.x to 0.2.0.
unsafe code
There will be unsafe code block to use NonZeroUsize::new_unchecked for maximum performance.