Skip to main content

ByteTable

Trait ByteTable 

Source
pub trait ByteTable<T: ByteEntry + Debug> {
    // Required methods
    fn table_get(&self, byte_key: u8) -> Option<&T>;
    fn table_get_slot(&mut self, byte_key: u8) -> Option<&mut Option<T>>;
    fn table_insert(&mut self, entry: T) -> Option<T>;
    fn table_grow(&mut self, grown: &mut Self);
}
Expand description

Operations on a cuckoo hash table indexed by single-byte keys.

Required Methods§

Source

fn table_get(&self, byte_key: u8) -> Option<&T>

Looks up an entry by its byte key, returning a reference if found.

Source

fn table_get_slot(&mut self, byte_key: u8) -> Option<&mut Option<T>>

Returns a mutable reference to the slot holding byte_key, if present.

Source

fn table_insert(&mut self, entry: T) -> Option<T>

Inserts entry into the table, returning it back if the table is full.

Source

fn table_grow(&mut self, grown: &mut Self)

Moves entries from self into grown, which must be twice the size.

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<T: ByteEntry + Debug> ByteTable<T> for [Option<T>]

Source§

fn table_insert(&mut self, inserted: T) -> Option<T>

An entry with the same key must not exist in the table yet.

Source§

fn table_get(&self, byte_key: u8) -> Option<&T>

Source§

fn table_get_slot(&mut self, byte_key: u8) -> Option<&mut Option<T>>

Source§

fn table_grow(&mut self, grown: &mut Self)

Implementors§