pub trait ServerInterceptor:
Send
+ Sync
+ 'static {
// Required methods
fn before<'a>(
&'a self,
ctx: &'a CallContext,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>;
fn after<'a>(
&'a self,
ctx: &'a CallContext,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>;
}Expand description
A server-side interceptor for request processing.
Interceptors run before and after the core handler logic. They can be used for logging, authentication, rate-limiting, or other cross-cutting concerns.
§Object safety
This trait is designed to be used behind Arc<dyn ServerInterceptor>.
Required Methods§
Sourcefn before<'a>(
&'a self,
ctx: &'a CallContext,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
fn before<'a>( &'a self, ctx: &'a CallContext, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".