pub trait Key: Copy {
type BYTES: AsRef<[u8]> + for<'a> TryFrom<&'a [u8]>;
const BYTES_SIZE: usize;
// Required methods
fn to_be_bytes(&self) -> Self::BYTES;
fn from_be_bytes(array: Self::BYTES) -> Self;
}
Expand description
A trait that represents a key, this key will be encoded to disk.
Required Associated Types§
Required Associated Constants§
sourceconst BYTES_SIZE: usize
const BYTES_SIZE: usize
The number of bytes the BYTES
array contains.
Required Methods§
sourcefn to_be_bytes(&self) -> Self::BYTES
fn to_be_bytes(&self) -> Self::BYTES
Returns an array of the key bytes in big-endian.
sourcefn from_be_bytes(array: Self::BYTES) -> Self
fn from_be_bytes(array: Self::BYTES) -> Self
Returns the key that corresponds to the given bytes array.
Object Safety§
This trait is not object safe.