pub trait MemoryBackend: Component {
// Required methods
fn append(&self, cx: &mut Cx, msg: Value) -> Result<()>;
fn recent(&self, cx: &mut Cx, count: u32) -> Result<Vec<Value>>;
fn search(&self, cx: &mut Cx, query: Expr, k: u32) -> Result<Vec<Value>>;
fn snapshot(&self, cx: &mut Cx) -> Result<Expr>;
fn restore(&self, cx: &mut Cx, snap: Expr) -> Result<()>;
}Expand description
Behavior shared by every memory backend: append, query, and snapshot/restore.
Required Methods§
Sourcefn recent(&self, cx: &mut Cx, count: u32) -> Result<Vec<Value>>
fn recent(&self, cx: &mut Cx, count: u32) -> Result<Vec<Value>>
Returns up to count most recent entries.
Sourcefn search(&self, cx: &mut Cx, query: Expr, k: u32) -> Result<Vec<Value>>
fn search(&self, cx: &mut Cx, query: Expr, k: u32) -> Result<Vec<Value>>
Returns up to k entries matching query.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".