Trait ValueCodec

Source
pub trait ValueCodec<S: Schema + ?Sized>:
    Sized
    + PartialEq
    + Debug {
    // Required methods
    fn encode_value(&self) -> Result<Vec<u8>>;
    fn decode_value(data: &[u8]) -> Result<Self>;
}
Expand description

This trait defines a type that can serve as a Schema::Value.

Required Methods§

Source

fn encode_value(&self) -> Result<Vec<u8>>

Converts self to bytes to be stored in DB.

Source

fn decode_value(data: &[u8]) -> Result<Self>

Converts bytes fetched from DB to Self.

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§