pub trait ByteArray: AsRef<[u8]> + AsMut<[u8]> + for<'a> TryFrom<&'a [u8], Error = ()> {
const LEN: usize;
// Provided methods
fn from_slice(data: &[u8]) -> Result<Self, ()> { ... }
fn to_raw_vec(&self) -> Vec<u8> ⓘ { ... }
fn as_slice(&self) -> &[u8] ⓘ { ... }
}
Expand description
Trait used for types that are really just a fixed-length array.
Required Associated Constants§
Provided Methods§
sourcefn from_slice(data: &[u8]) -> Result<Self, ()>
fn from_slice(data: &[u8]) -> Result<Self, ()>
A new instance from the given slice that should be Self::LEN
bytes long.
sourcefn to_raw_vec(&self) -> Vec<u8> ⓘ
fn to_raw_vec(&self) -> Vec<u8> ⓘ
Return a Vec<u8>
filled with raw data.