pub trait IntKey: Sized + Copy {
    type Buf: AsRef<[u8]> + AsMut<[u8]> + Into<Vec<u8>> + Default;

    // Required methods
    fn to_cw_bytes(&self) -> Self::Buf;
    fn from_cw_bytes(bytes: Self::Buf) -> Self;
}
Expand description

Our int keys are simply the big-endian representation bytes for unsigned ints, but “sign-flipped” (xored msb) big-endian bytes for signed ints.

So that the representation of signed integers is in the right lexicographical order.

Required Associated Types§

source

type Buf: AsRef<[u8]> + AsMut<[u8]> + Into<Vec<u8>> + Default

Required Methods§

source

fn to_cw_bytes(&self) -> Self::Buf

source

fn from_cw_bytes(bytes: Self::Buf) -> Self

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl IntKey for i8

§

type Buf = [u8; 1]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for i16

§

type Buf = [u8; 2]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for i32

§

type Buf = [u8; 4]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for i64

§

type Buf = [u8; 8]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for i128

§

type Buf = [u8; 16]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for u8

§

type Buf = [u8; 1]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for u16

§

type Buf = [u8; 2]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for u32

§

type Buf = [u8; 4]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for u64

§

type Buf = [u8; 8]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

source§

impl IntKey for u128

§

type Buf = [u8; 16]

source§

fn to_cw_bytes(&self) -> Self::Buf

source§

fn from_cw_bytes(bytes: Self::Buf) -> Self

Implementors§