Skip to main content

TypedExtractorHandler

Trait TypedExtractorHandler 

Source
pub trait TypedExtractorHandler<S, T, I>:
    Clone
    + Send
    + Sync
    + 'static
where I: JsonSchema,
{ type Future: Future<Output = Result<CallToolResult>> + Send; // Required method fn call(self, ctx: RequestContext, state: S, args: Value) -> Self::Future; }
Expand description

A handler that uses extractors with typed JSON input.

This trait is similar to ExtractorHandler but provides proper JSON schema generation for the input type when Json<T> is used.

Required Associated Types§

Source

type Future: Future<Output = Result<CallToolResult>> + Send

The future returned by the handler.

Required Methods§

Source

fn call(self, ctx: RequestContext, state: S, args: Value) -> Self::Future

Call the handler with extracted values.

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<S, F, Fut, T1, T2, T3, T> TypedExtractorHandler<S, (T1, T2, T3, Json<T>), T> for F
where S: Clone + Send + Sync + 'static, F: Fn(T1, T2, T3, Json<T>) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Result<CallToolResult>> + Send, T1: FromToolRequest<S> + Send, T2: FromToolRequest<S> + Send, T3: FromToolRequest<S> + Send, T: DeserializeOwned + JsonSchema + Send,

Source§

impl<S, F, Fut, T1, T2, T> TypedExtractorHandler<S, (T1, T2, Json<T>), T> for F
where S: Clone + Send + Sync + 'static, F: Fn(T1, T2, Json<T>) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Result<CallToolResult>> + Send, T1: FromToolRequest<S> + Send, T2: FromToolRequest<S> + Send, T: DeserializeOwned + JsonSchema + Send,

Source§

impl<S, F, Fut, T1, T> TypedExtractorHandler<S, (T1, Json<T>), T> for F
where S: Clone + Send + Sync + 'static, F: Fn(T1, Json<T>) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Result<CallToolResult>> + Send, T1: FromToolRequest<S> + Send, T: DeserializeOwned + JsonSchema + Send,

Source§

impl<S, F, Fut, T> TypedExtractorHandler<S, (Json<T>,), T> for F
where S: Clone + Send + Sync + 'static, F: Fn(Json<T>) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Result<CallToolResult>> + Send, T: DeserializeOwned + JsonSchema + Send,