Trait Database

Source
pub trait Database {
    // Required methods
    fn tget<T: Table>(&self, k: &T::Key) -> Option<T>;
    fn trange<T: Table>(&self, range: Range<&T::Key>) -> Vec<T>;
    fn tput<T: Table>(&self, k: &T::Key, v: &T) -> Option<T>;
    fn tscan<T: Table>(&self) -> Vec<T>;
}
Expand description

Trait denoting an engine capable of providing storage for tables

Required Methods§

Source

fn tget<T: Table>(&self, k: &T::Key) -> Option<T>

Serializes the key and retrieves what was stored using this key

Source

fn trange<T: Table>(&self, range: Range<&T::Key>) -> Vec<T>

Source

fn tput<T: Table>(&self, k: &T::Key, v: &T) -> Option<T>

Serializes the key and value using proper formats(Big endian for key, little endian for values) and safely stores this entry in the database

Source

fn tscan<T: Table>(&self) -> Vec<T>

Performs a full table scan of a specified table

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 Database for Tree

Source§

fn tget<T: Table>(&self, k: &T::Key) -> Option<T>

Source§

fn trange<T: Table>(&self, range: Range<&T::Key>) -> Vec<T>

Source§

fn tput<T: Table>(&self, k: &T::Key, v: &T) -> Option<T>

Source§

fn tscan<T: Table>(&self) -> Vec<T>

Implementors§