pub trait RequestHandler<B> {
    type Action: Action;

    // Required methods
    fn action() -> Self::Action
       where Self: Sized;
    fn validate_data(&self, data: &Data);
    fn handle<'a>(
        &'a self,
        msg: Message<Self::Action, B>,
        data: &'a Data,
        session: &'a Session
    ) -> PinnedFuture<'a, Result<Message<Self::Action, B>, Error>> ;
}

Required Associated Types§

Required Methods§

source

fn action() -> Self::Action
where Self: Sized,

source

fn validate_data(&self, data: &Data)

if the data is not available just panic

source

fn handle<'a>( &'a self, msg: Message<Self::Action, B>, data: &'a Data, session: &'a Session ) -> PinnedFuture<'a, Result<Message<Self::Action, B>, Error>>

handles a message with Self::ACTION as action.

if None is returned the request is abandoned and the requestor receives a RequestDropped error

Implementors§