Skip to main content

Handler

Trait Handler 

Source
pub trait Handler<R: ReplySink>:
    MaybeSend
    + MaybeSync
    + 'static {
    // Required method
    fn handle(
        &self,
        call: SelfRef<RequestCall<'static>>,
        reply: R,
        schemas: Arc<SchemaRecvTracker>,
    ) -> impl Future<Output = ()> + MaybeSend + '_;

    // Provided methods
    fn retry_policy(&self, _method_id: MethodId) -> RetryPolicy { ... }
    fn args_have_channels(&self, _method_id: MethodId) -> bool { ... }
    fn response_wire_shape(
        &self,
        _method_id: MethodId,
    ) -> Option<&'static Shape> { ... }
}

Required Methods§

Source

fn handle( &self, call: SelfRef<RequestCall<'static>>, reply: R, schemas: Arc<SchemaRecvTracker>, ) -> impl Future<Output = ()> + MaybeSend + '_

Dispatch an incoming call to the appropriate method implementation.

Provided Methods§

Source

fn retry_policy(&self, _method_id: MethodId) -> RetryPolicy

Return the static retry policy for a method ID served by this handler.

Source

fn args_have_channels(&self, _method_id: MethodId) -> bool

Return whether the method’s argument shape contains any channels.

Source

fn response_wire_shape(&self, _method_id: MethodId) -> Option<&'static Shape>

Return the canonical wire response shape for a method, if known.

This is the full wire type Result<T, VoxError<E>>, not the user-facing return type T or Result<T, E>.

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.

Implementations on Foreign Types§

Source§

impl<R: ReplySink> Handler<R> for ()

Source§

async fn handle( &self, _call: SelfRef<RequestCall<'static>>, _reply: R, _schemas: Arc<SchemaRecvTracker>, )

Implementors§