pub trait Provider:
Send
+ Sync
+ Debug {
// Required methods
fn name(&self) -> &'static str;
fn remember(&self, cx: &Context, new: New) -> Result<Memory, Error>;
fn list(
&self,
cx: &Context,
scope: Option<Scope>,
kind: Option<Kind>,
) -> Result<Found, Error>;
fn get(&self, cx: &Context, id: &str) -> Result<Memory, Error>;
fn update(
&self,
cx: &Context,
id: &str,
change: Change,
) -> Result<Memory, Error>;
fn forget(&self, cx: &Context, id: &str) -> Result<Memory, Error>;
fn put(&self, cx: &Context, m: &Memory) -> Result<Memory, Error>;
// Provided method
fn recall(
&self,
cx: &Context,
query: &str,
scope: Option<Scope>,
limit: Option<usize>,
) -> Result<Found, Error> { ... }
}Expand description
A memory store. Every method resolves the project and session scopes
from cx; scope: None means every scope cx reaches. Providers
keep no cache that could go stale against their store.
Required Methods§
fn remember(&self, cx: &Context, new: New) -> Result<Memory, Error>
Sourcefn list(
&self,
cx: &Context,
scope: Option<Scope>,
kind: Option<Kind>,
) -> Result<Found, Error>
fn list( &self, cx: &Context, scope: Option<Scope>, kind: Option<Kind>, ) -> Result<Found, Error>
Newest first.
fn get(&self, cx: &Context, id: &str) -> Result<Memory, Error>
fn update( &self, cx: &Context, id: &str, change: Change, ) -> Result<Memory, Error>
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".