pub trait TransferHandler<I: Instant, T: Transport> {
    // Provided methods
    fn handle_message<N: Node<Instant = I, Transport = T>>(
        &mut self,
        _node: &mut N,
        _transfer: &MessageTransfer<Vec<u8>, I, T>
    ) -> bool { ... }
    fn handle_request<N: Node<Instant = I, Transport = T>>(
        &mut self,
        _node: &mut N,
        _token: ResponseToken<T>,
        _transfer: &ServiceTransfer<Vec<u8>, I, T>
    ) -> bool { ... }
    fn handle_response<N: Node<Instant = I, Transport = T>>(
        &mut self,
        _node: &mut N,
        _transfer: &ServiceTransfer<Vec<u8>, I, T>
    ) -> bool { ... }
    fn handle_loopback<N: Node<Instant = I, Transport = T>>(
        &mut self,
        _node: &mut N,
        _transfer: &Transfer<Vec<u8>, I, T>
    ) -> bool { ... }
    fn chain<H>(self, next: H) -> TransferHandlerChain<Self, H>
       where Self: Sized,
             H: TransferHandler<I, T> { ... }
}
Expand description

Something that may be able to handle incoming transfers

Provided Methods§

source

fn handle_message<N: Node<Instant = I, Transport = T>>( &mut self, _node: &mut N, _transfer: &MessageTransfer<Vec<u8>, I, T> ) -> bool

Potentially handles an incoming message transfer

This function does not handle any loopback transfers.

This function returns true if the message was handled and should not be sent on to other handlers.

The default implementation does nothing and returns false.

source

fn handle_request<N: Node<Instant = I, Transport = T>>( &mut self, _node: &mut N, _token: ResponseToken<T>, _transfer: &ServiceTransfer<Vec<u8>, I, T> ) -> bool

Potentially handles an incoming service request

This function does not handle any loopback transfers.

This function returns true if the request was handled and should not be sent on to other handlers.

The default implementation does nothing and returns false.

source

fn handle_response<N: Node<Instant = I, Transport = T>>( &mut self, _node: &mut N, _transfer: &ServiceTransfer<Vec<u8>, I, T> ) -> bool

Potentially handles an incoming service response

This function does not handle any loopback transfers.

This function returns true if the response was handled and should not be sent on to other handlers.

The default implementation does nothing and returns false.

source

fn handle_loopback<N: Node<Instant = I, Transport = T>>( &mut self, _node: &mut N, _transfer: &Transfer<Vec<u8>, I, T> ) -> bool

Potentially handles a loopback transfer sent from this node

All loopback transfers (message, request, and response) are handled here.

This function returns true if the response was handled and should not be sent on to other handlers.

The default implementation does nothing and returns false.

source

fn chain<H>(self, next: H) -> TransferHandlerChain<Self, H>where Self: Sized, H: TransferHandler<I, T>,

Chains another handler after this handler and returns the combined handler

For each incoming transfer, this handler will be given the transfer before the next handler.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'h, I, T, H> TransferHandler<I, T> for &'h mut Hwhere I: Instant, T: Transport, H: TransferHandler<I, T>,

source§

fn handle_message<N: Node<Instant = I, Transport = T>>( &mut self, node: &mut N, transfer: &MessageTransfer<Vec<u8>, I, T> ) -> bool

source§

fn handle_request<N: Node<Instant = I, Transport = T>>( &mut self, node: &mut N, token: ResponseToken<T>, transfer: &ServiceTransfer<Vec<u8>, I, T> ) -> bool

source§

fn handle_response<N: Node<Instant = I, Transport = T>>( &mut self, node: &mut N, transfer: &ServiceTransfer<Vec<u8>, I, T> ) -> bool

source§

fn handle_loopback<N: Node<Instant = I, Transport = T>>( &mut self, node: &mut N, transfer: &Transfer<Vec<u8>, I, T> ) -> bool

source§

fn chain<H1>(self, next: H1) -> TransferHandlerChain<Self, H1>where Self: Sized, H1: TransferHandler<I, T>,

Implementors§

source§

impl<I, B, T> TransferHandler<I, T> for RegisterHandler<B>where I: Instant, B: RegisterBlock, T: Transport,

source§

impl<I, T, H0, H1> TransferHandler<I, T> for TransferHandlerChain<H0, H1>where I: Instant, T: Transport, H0: TransferHandler<I, T>, H1: TransferHandler<I, T>,