Trait Key

Source
pub trait Key:
    Copy
    + PartialEq
    + Ord
    + Default
    + Debug {
    type Bytes: AsRef<[u8]>;

    // Required methods
    fn into_bytes(self) -> Self::Bytes;
    fn from_bytes(bytes: Self::Bytes) -> Self;
}

Required Associated Types§

Required Methods§

Source

fn into_bytes(self) -> Self::Bytes

Source

fn from_bytes(bytes: Self::Bytes) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Key for u8

Source§

type Bytes = [u8; 1]

Source§

fn into_bytes(self) -> Self::Bytes

Source§

fn from_bytes(bytes: Self::Bytes) -> Self

Source§

impl Key for u16

Source§

type Bytes = [u8; 2]

Source§

fn into_bytes(self) -> Self::Bytes

Source§

fn from_bytes(bytes: Self::Bytes) -> Self

Source§

impl Key for u32

Source§

type Bytes = [u8; 4]

Source§

fn into_bytes(self) -> Self::Bytes

Source§

fn from_bytes(bytes: Self::Bytes) -> Self

Source§

impl Key for u64

Source§

type Bytes = [u8; 8]

Source§

fn into_bytes(self) -> Self::Bytes

Source§

fn from_bytes(bytes: Self::Bytes) -> Self

Source§

impl Key for usize

Source§

type Bytes = [u8; 8]

Source§

fn into_bytes(self) -> Self::Bytes

Source§

fn from_bytes(bytes: Self::Bytes) -> Self

Implementors§