diff --git a/Cargo.toml b/Cargo.toml index 16078d4..05fe323 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nebz" -version = "0.2.0" +version = "0.2.0-pre" edition = "2024" description = "an immutable non-empty bytes container" readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 19c272a..62682f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -147,6 +147,11 @@ impl<'a, const N: usize> NonEmptyBz<&'a [u8; N]> { const { assert!(N != 0) } Self(bz) } + + /// Converts a `NonEmptyBz<&[u8; N]` to `NonEmptyBz<&[u8]>`. + pub const fn as_slice(&self) -> NonEmptyBz<&'a [u8]> { + NonEmptyBz(self.0) + } } #[cfg(feature = "bytes")]