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:
| Strategy | Attribute | Fetch return |
|---|---|---|
| Serde (default) | (none) | T (owned, bincode) |
| Pod | #[payload(storage = "pod")] | &T (zero-copy mmap) |
Required Associated Types§
Sourcetype Store: OwnedPayloadStore<Self>
type Store: OwnedPayloadStore<Self>
The read-only store produced by Builder and held inside
SealedRingDb.
Required Methods§
Sourcefn make_builder() -> Result<Self::Builder>
fn make_builder() -> Result<Self::Builder>
Create a fresh builder (called by RingDb::new).
Sourcefn load_store(dir: &Path) -> Result<Self::Store>
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.