ResponseHandler

Trait ResponseHandler 

Source
pub trait ResponseHandler<S: Service, M: Message>: Send + 'static {
    // Required method
    fn respond(
        self,
        service: &mut S,
        ctx: &mut ServiceContext<S>,
        tx: Option<Sender<M::Response>>,
    );
}
Expand description

Handler implementation for handling what happens with a response value

Required Methods§

Source

fn respond( self, service: &mut S, ctx: &mut ServiceContext<S>, tx: Option<Sender<M::Response>>, )

Implementations on Foreign Types§

Source§

impl<S, M> ResponseHandler<S, M> for ()
where S: Service, M: Message<Response = ()>,

Void response handler for sending an empty unit response automatically after executing

Source§

fn respond( self, _service: &mut S, _ctx: &mut ServiceContext<S>, tx: Option<Sender<<M as Message>::Response>>, )

Source§

impl<S, M, R> ResponseHandler<S, M> for Option<R>
where R: ResponseHandler<S, M>, S: Service, M: Message,

Response handler for optional handler types to handle not sending any response

Source§

fn respond( self, service: &mut S, ctx: &mut ServiceContext<S>, tx: Option<Sender<<M as Message>::Response>>, )

Source§

impl<S, M, R, E> ResponseHandler<S, M> for Result<R, E>
where R: ResponseHandler<S, M>, S: Service + ErrorHandler<E>, M: Message, E: Send + 'static,

Response handler for result response types where the error half of the result can be handled by a service error handler

Source§

fn respond( self, service: &mut S, ctx: &mut ServiceContext<S>, tx: Option<Sender<<M as Message>::Response>>, )

Implementors§

Source§

impl<S, M> ResponseHandler<S, M> for Fr<M>
where S: Service, M: Message,

Source§

impl<S, M> ResponseHandler<S, M> for Mr<M>
where S: Service, M: Message,

Source§

impl<S, M> ResponseHandler<S, M> for Sfr<S, M>
where S: Service, M: Message,

The response handler for service future responses passes on the producer in an envelope to be handled by the context