Skip to main content

Store

Trait Store 

Source
pub trait Store<T>: Send + Sync {
    // Required methods
    fn insert(&self, model: T) -> Result<()>;
    fn get(&self, id: &str) -> Result<Option<T>>;
    fn delete(&self, id: &str) -> Result<()>;
}
Expand description

Generic CRUD trait for backing stores.

Required Methods§

Source

fn insert(&self, model: T) -> Result<()>

Insert or update a model in the store.

Source

fn get(&self, id: &str) -> Result<Option<T>>

Retrieve a model by identifier.

Source

fn delete(&self, id: &str) -> Result<()>

Delete a model by identifier.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§