Trait Datum

Source
pub trait Datum: Sized {
    // Required methods
    fn to_datum(&self) -> Result<Vec<u8>, Box<dyn StdError + Sync + Send>>;
    fn from_datum(b: Vec<u8>) -> Result<Self, Box<dyn StdError + Sync + Send>>;
}
Expand description

A datum represents a single item in the database. Any type used as key or value needs to implement Datum.

Any type implementing Serialize and Deserialize also implements Datum.

Required Methods§

Source

fn to_datum(&self) -> Result<Vec<u8>, Box<dyn StdError + Sync + Send>>

Source

fn from_datum(b: Vec<u8>) -> Result<Self, Box<dyn StdError + Sync + Send>>

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§