Skip to main content

Handler

Trait Handler 

Source
pub trait Handler {
    type Input: ?Sized;
    type Context: ?Sized;
    type Output;
    type Error;

    // Required method
    fn handle(
        &self,
        input: &Self::Input,
        context: &mut Self::Context,
    ) -> Result<Self::Output, Self::Error>;
}
Expand description

Executes a selected dispatch-table item.

The input is immutable. Mutable runtime state, services, buffers, or device handles should be placed in Self::Context. Implementations that do not need a context can use ().

Required Associated Types§

Source

type Input: ?Sized

Input accepted by the handler.

Source

type Context: ?Sized

Mutable runtime context used by the handler.

Source

type Output

Value produced by the handler.

Source

type Error

Error produced by the handler.

Required Methods§

Source

fn handle( &self, input: &Self::Input, context: &mut Self::Context, ) -> Result<Self::Output, Self::Error>

Handles input using context and returns an output.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§