Provide the following methods for NonEmptyBz:
impl<T: AsRef<[u8]>> NonEmptyBz<T> {
/// Returns the first byte of the contained value.
pub fn first(&self) -> u8;
/// Returns the last byte of the contained value.
pub fn last(&self) -> u8;
/// Returns the first byte and the remaining slice.
///
/// The remaining slice will be empty if the contained value has only one byte.
pub fn split_first(&self) -> (u8, &[u8]);
/// Returns the last byte and the remaining slice.
///
/// The remaining slice will be empty if the contained value has only one byte.
pub fn split_last(&self) -> (u8, &[u8]);
}
unsafe code
There will be unsafe blocks to use the slice::get_unchecked method for maximum performance.
miri
Ensure all the edge cases are properly tested.
Provide the following methods for
NonEmptyBz:unsafe code
There will be unsafe blocks to use the
slice::get_uncheckedmethod for maximum performance.miri
Ensure all the edge cases are properly tested.