Skip to content

remove is_empty() and return non-zero length #9

@rotorship

Description

@rotorship

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions