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§
Sourcefn set_extension<T>(&self, value: T) -> impl Future<Output = ()> + Send
fn set_extension<T>(&self, value: T) -> impl Future<Output = ()> + Send
Set extension data
Sourcefn get_extension<T>(&self) -> impl Future<Output = Option<T>> + Send
fn get_extension<T>(&self) -> impl Future<Output = Option<T>> + Send
Get extension data
Sourcefn remove_extension<T>(&self) -> impl Future<Output = Option<T>> + Send
fn remove_extension<T>(&self) -> impl Future<Output = Option<T>> + Send
Remove extension data
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§
impl ContextExt for AgentContext
Implement ContextExt for CoreAgentContext using extension storage