LiveMemoryExt

Trait LiveMemoryExt 

Source
pub trait LiveMemoryExt: Sized {
    // Required methods
    fn with_memory(self, session: Arc<MemorySession>) -> Self;
    fn with_memory_slots(
        self,
        session: Arc<MemorySession>,
        slots: impl IntoIterator<Item = MemorySlot>,
    ) -> Self;
}
Expand description

Installs the memory subsystem onto a Live builder.

Required Methods§

Source

fn with_memory(self, session: Arc<MemorySession>) -> Self

Wire memory in: ingestion, retrieval preparation, and the two tools.

Live::builder().with_memory(session);
Source

fn with_memory_slots( self, session: Arc<MemorySession>, slots: impl IntoIterator<Item = MemorySlot>, ) -> Self

Wire memory in, projecting remembered facts into governed State slots.

A slot filled from memory satisfies phase.needs(..), phase.requires(..) and Flow guards exactly as one filled by the user would — which is the point. The application asks for what it needs and does not have to care whether the answer arrived this minute or last month.

Live::builder()
    .with_memory_slots(
        session,
        [
            MemorySlot::new("dietary_identity", "user:diet"),
            MemorySlot::new("venue_preference", "user:venue"),
        ],
    )
    // Satisfied from memory for a returning user, so they are not
    // asked again for something they already told us.
    .phase("plan_dinner")
        .needs(&["user:diet", "user:venue"])
        .done();

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.

Implementations on Foreign Types§

Source§

impl LiveMemoryExt for Live

Source§

fn with_memory(self, session: Arc<MemorySession>) -> Self

Source§

fn with_memory_slots( self, session: Arc<MemorySession>, slots: impl IntoIterator<Item = MemorySlot>, ) -> Self

Implementors§