Skip to main content

Handle

Trait Handle 

Source
pub trait Handle<In, R = (), O = (), C = (), S = ()>: Send + Sync
where In: Input + ?Sized,
{ // Required method fn handle( &self, input: &In, outs: &O, ctx: &mut Context<'_, C, S>, ) -> impl Future<Output = Result<R, <<<In as Input>::Axis as Axis>::Family as VerdictFamily>::Bad>> + Send; }
Expand description

The one body contract of the manual path: every axis of the form matrix is a defaulted parameter the impl pins.

The lane is the type’s business on both ends: a serde input decodes through the codec while a Deserialized one constructs itself from the payload, and a serde reply encodes through the reply codec while a Serialized one leaves byte-for-byte.

The outs parameter carries the injections arena for a body that declared one (O other than ()); a body without injections takes &(). The returned future’s output is the input family’s canonical verdict (Verdict<In, R>): Result<R, HandlerOutcome> for one message at a time, Result<R, Vec<HandlerOutcome>> for a batch - so the body’s async fn signature spells the verdict out literally.

Required Methods§

Source

fn handle( &self, input: &In, outs: &O, ctx: &mut Context<'_, C, S>, ) -> impl Future<Output = Result<R, <<<In as Input>::Axis as Axis>::Family as VerdictFamily>::Bad>> + Send

Handles one input (a message, or a batch of them).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§