Skip to main content

ContextExt

Trait ContextExt 

Source
pub trait ContextExt {
    // Required methods
    fn set_extension<T>(&self, value: T) -> impl Future<Output = ()> + Send
       where T: Send + Sync + Serialize + 'static;
    fn get_extension<T>(&self) -> impl Future<Output = Option<T>> + Send
       where T: Send + Sync + DeserializeOwned + 'static;
    fn remove_extension<T>(&self) -> impl Future<Output = Option<T>> + Send
       where T: Send + Sync + DeserializeOwned + 'static;
    fn has_extension<T>(&self) -> impl Future<Output = bool> + Send
       where T: Send + Sync + 'static;
}
Expand description

Generic context extension trait

Allows adding custom data to any context implementation

Required Methods§

Source

fn set_extension<T>(&self, value: T) -> impl Future<Output = ()> + Send
where T: Send + Sync + Serialize + 'static,

Set extension data

Source

fn get_extension<T>(&self) -> impl Future<Output = Option<T>> + Send
where T: Send + Sync + DeserializeOwned + 'static,

Get extension data

Source

fn remove_extension<T>(&self) -> impl Future<Output = Option<T>> + Send
where T: Send + Sync + DeserializeOwned + 'static,

Remove extension data

Source

fn has_extension<T>(&self) -> impl Future<Output = bool> + Send
where T: Send + Sync + 'static,

Check if extension exists

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.

Implementors§

Source§

impl ContextExt for AgentContext

Implement ContextExt for CoreAgentContext using extension storage