Skip to main content

dispatch_through

Function dispatch_through 

Source
pub async fn dispatch_through<'a, F, Fut>(
    chain: &'a [Arc<dyn ToolMiddleware>],
    call: ToolCall,
    cancel: CancellationToken,
    dispatch: F,
) -> ToolOutcome
where F: Fn(CancellationToken) -> Fut + Send + Sync + 'a, Fut: Future<Output = ToolOutcome> + Send + 'a,
Expand description

Run chain around dispatch.

With an empty chain this is dispatch and nothing else — no clone, no allocation, no future wrapped in another future. That matters: tool dispatch is on the hot path, and a seam nobody uses should cost nothing.