Skip to main content

ContextAdapter

Trait ContextAdapter 

Source
pub trait ContextAdapter: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn produce<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 ContextInput,
    ) -> Pin<Box<dyn Future<Output = ContextResult<Vec<Message>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Pluggable context source that produces message fragments.

Required Methods§

Source

fn name(&self) -> &str

Returns the adapter name.

Source

fn produce<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 ContextInput, ) -> Pin<Box<dyn Future<Output = ContextResult<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Produces message fragments for the given input.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl ContextAdapter for StaticAdapter

Source§

impl<F, Fut> ContextAdapter for FunctionAdapter<F>
where F: Fn(ContextInput) -> Fut + Send + Sync + 'static, Fut: Future<Output = ContextResult<Vec<Message>>> + Send + 'static,