Skip to main content

StoreKey

Trait StoreKey 

Source
pub trait StoreKey: KeyBase + Ord {
    // Required method
    fn as_slice(&self) -> &[u8] ⓘ;

    // Provided method
    fn write_to(&self, buf: &mut Vec<u8>) { ... }
}
Expand description

A trait for keys that can be stored in the database. They need to allow hashing and comparison.

Required Methods§

Source

fn as_slice(&self) -> &[u8] ⓘ

The key’s bytes.

Provided Methods§

Source

fn write_to(&self, buf: &mut Vec<u8>)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StoreKey for &[u8]

Source§

fn as_slice(&self) -> &[u8] ⓘ

Source§

impl StoreKey for Box<[u8]>

Source§

fn as_slice(&self) -> &[u8] ⓘ

Source§

impl StoreKey for Vec<u8>

Source§

fn as_slice(&self) -> &[u8] ⓘ

Source§

impl<T: StoreKey> StoreKey for &T

Source§

fn as_slice(&self) -> &[u8] ⓘ

Source§

impl<const N: usize> StoreKey for [u8; N]

Source§

fn as_slice(&self) -> &[u8] ⓘ

Implementors§