Trait RaxKey

Source
pub trait RaxKey<RHS = Self>:
    Clone
    + Default
    + Debug {
    type Output: RaxKey;

    // Required methods
    fn encode(self) -> Self::Output;
    fn to_buf(&self) -> (*const u8, usize);
    fn from_buf(ptr: *const u8, len: usize) -> RHS;
}
Expand description

Same as RaxMap except values are not pointers to heap allocations. Instead the “data pointer” in the RAX is the value. This means we have sizeof worth of bytes to play with. Perhaps, in the future we could create data values of any size, but for now we have the size of pointers to work with or null which has no added size to a rax node.

Required Associated Types§

Required Methods§

Source

fn encode(self) -> Self::Output

Source

fn to_buf(&self) -> (*const u8, usize)

Source

fn from_buf(ptr: *const u8, len: usize) -> RHS

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 RaxKey for f32

Source§

type Output = u32

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> f32

Source§

impl RaxKey for f64

Source§

type Output = u64

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> f64

Source§

impl RaxKey for i16

Source§

type Output = i16

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> Self

Source§

impl RaxKey for i32

Source§

type Output = i32

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> i32

Source§

impl RaxKey for i64

Source§

type Output = i64

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> i64

Source§

impl RaxKey for i128

Source§

impl RaxKey for isize

Source§

impl RaxKey for u16

Source§

type Output = u16

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> u16

Source§

impl RaxKey for u32

Source§

type Output = u32

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> u32

Source§

impl RaxKey for u64

Source§

type Output = u64

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> u64

Source§

impl RaxKey for u128

Source§

impl RaxKey for usize

Source§

impl RaxKey for Vec<u8>

Source§

impl<'a> RaxKey for &'a str

Source§

type Output = &'a str

Source§

fn encode(self) -> Self::Output

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> &'a str

Source§

impl<'a> RaxKey for &'a [u8]

Source§

type Output = &'a [u8]

Source§

fn encode(self) -> &'a [u8]

Source§

fn to_buf(&self) -> (*const u8, usize)

Source§

fn from_buf(ptr: *const u8, len: usize) -> &'a [u8]

Implementors§