pub trait BaseMemory: Send + Sync {
// Required methods
fn memory_variables(&self) -> Vec<&str>;
fn load_memory_variables<'life0, 'life1, 'async_trait>(
&'life0 self,
inputs: &'life1 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
inputs: &'life1 HashMap<String, String>,
outputs: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn clear<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Base Memory trait
The base interface for all Memory types.
Required Methods§
Sourcefn memory_variables(&self) -> Vec<&str>
fn memory_variables(&self) -> Vec<&str>
Get memory variable names
Returns all variable keys stored in memory.
Sourcefn load_memory_variables<'life0, 'life1, 'async_trait>(
&'life0 self,
inputs: &'life1 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_memory_variables<'life0, 'life1, 'async_trait>(
&'life0 self,
inputs: &'life1 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn save_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
inputs: &'life1 HashMap<String, String>,
outputs: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
inputs: &'life1 HashMap<String, String>,
outputs: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Save context
§Arguments
inputs- User inputoutputs- System output
§Contract
缺失 input / output key 时返回 MemoryError::SaveError。
所有内置实现(Buffer / Window / Summary / SummaryBuffer)行为一致,
不做静默空串兜底。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".