Skip to main content

Store

Trait Store 

Source
pub trait Store<Q, T> {
    // Required methods
    async fn get(&self, query: &Q) -> Result<Option<T>, Box<dyn Error>>;
    async fn put(&self, query: &Q, value: &T) -> Result<(), Box<dyn Error>>;
}
Expand description

Cache or sink abstraction for persisted query results.

Required Methods§

Source

async fn get(&self, query: &Q) -> Result<Option<T>, Box<dyn Error>>

Returns a cached value when it exists.

Source

async fn put(&self, query: &Q, value: &T) -> Result<(), Box<dyn Error>>

Persists a value for future reads.

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§

Source§

impl<Q, T> Store<Q, T> for InMemoryStore<Q, T>
where Q: Eq + Hash + Clone, T: Clone,