Skip to main content

Payload

Trait Payload 

Source
pub trait Payload: Sized {
    type Store: OwnedPayloadStore<Self>;
    type Builder: PayloadBuilderOps<Self, Store = Self::Store>;

    // Required methods
    fn make_builder() -> Result<Self::Builder>;
    fn load_store(dir: &Path) -> Result<Self::Store>;
}
Expand description

Marker trait that ties a user type to its payload storage strategy.

Implement this trait via #[derive(Payload)] from the ring-db-derive crate (re-exported as ringdb::Payload).

Two storage strategies are available:

StrategyAttributeFetch return
Serde (default)(none)T (owned, bincode)
Pod#[payload(storage = "pod")]&T (zero-copy mmap)

Required Associated Types§

Source

type Store: OwnedPayloadStore<Self>

The read-only store produced by Builder and held inside SealedRingDb.

Source

type Builder: PayloadBuilderOps<Self, Store = Self::Store>

The write-side builder held inside RingDb during insertion. Consumed by build() to produce Store.

Required Methods§

Source

fn make_builder() -> Result<Self::Builder>

Create a fresh builder (called by RingDb::new).

Source

fn load_store(dir: &Path) -> Result<Self::Store>

Load the store from a persisted directory (called by RingDb::load).

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 Payload for ()

Implementors§