Skip to main content

ContextProvider

Trait ContextProvider 

Source
pub trait ContextProvider:
    Send
    + Sync
    + 'static {
    type Context: JsonSchema + Serialize + LLMSafe + Send + Sync + 'static;

    const NAME: &'static str;
    const SCOPE: TemporalScope;

    // Required method
    fn context<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ContextRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Context, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn subscribe(&self) -> Option<Receiver<()>> { ... }
}

Required Associated Constants§

Source

const NAME: &'static str

Declarative compile-time semantic key (e.g., “state”, “active_tasks”)

Source

const SCOPE: TemporalScope

The dimension this context belongs to

Required Associated Types§

Required Methods§

Source

fn context<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ContextRequest, ) -> Pin<Box<dyn Future<Output = Result<Self::Context, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provide the JSON-serializable context view, filtered associatively via ContextRequest

Provided Methods§

Source

fn subscribe(&self) -> Option<Receiver<()>>

Decentralized Wakeup Signal: Returns a receiver that signals when this specific context mutates.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§