Database

Trait Database 

Source
pub trait Database<B>
where B: Backend,
{ // Required methods fn get<D>(&mut self, path: &str) -> Result<Option<D>, ()> where D: DeserializeOwned; fn save<'a, D>(&mut self, path: &str, data: &'a D) -> Result<&'a D, ()> where D: Serialize; }
Expand description

Database to read and write data from the durable storage

Each field of the struct will be written in the

Required Methods§

Source

fn get<D>(&mut self, path: &str) -> Result<Option<D>, ()>

Get the data from the database at a given path

Source

fn save<'a, D>(&mut self, path: &str, data: &'a D) -> Result<&'a D, ()>
where D: Serialize,

Save the data in the database at a given path

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.

Implementors§

Source§

impl<R, B> Database<B> for R
where R: Runtime, B: Backend,