Skip to main content

BaseMemory

Trait BaseMemory 

Source
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§

Source

fn memory_variables(&self) -> Vec<&str>

Get memory variable names

Returns all variable keys stored in memory.

Source

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,

Load memory variables

§Arguments
  • inputs - Current input
§Returns

Memory variable dictionary

Source

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 input
  • outputs - System output
§Contract

Missing input / output keys return MemoryError::SaveError. All built-in implementations (Buffer / Window / Summary / SummaryBuffer) behave consistently, with no silent empty-string fallback.

Source

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,

Clear memory

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§