Skip to main content

ToolHandler

Type Alias ToolHandler 

Source
pub type ToolHandler = Arc<dyn Fn(RequestContext, JsonObject) -> BoxFuture + Send + Sync>;
Expand description

A tool handler, and what it answers with.

The boxed form rather than a generic parameter, deliberately: a server holds a heterogeneous set of these behind one name, so there is nothing to monomorphise over. The alternative — a generic Server<H> — buys nothing here and makes the struct unnameable in a field.

The Send bound is load-bearing. A handler runs on the runtime, and a handler that is not Send cannot be sent to it.

Aliased Type§

pub struct ToolHandler { /* private fields */ }