tokio_proto::streaming::multiplex::advanced

Trait Dispatch

Source
pub trait Dispatch {
    type Io;
    type In;
    type BodyIn;
    type Out;
    type BodyOut;
    type Error: From<Error>;
    type Stream: Stream<Item = Self::BodyIn, Error = Self::Error>;
    type Transport: Transport<Self::BodyOut, Item = Frame<Self::Out, Self::BodyOut, Self::Error>, SinkItem = Frame<Self::In, Self::BodyIn, Self::Error>>;

    // Required methods
    fn transport(&mut self) -> &mut Self::Transport;
    fn poll(
        &mut self,
    ) -> Poll<Option<MultiplexMessage<Self::In, Self::Stream, Self::Error>>, Error>;
    fn poll_ready(&self) -> Async<()>;
    fn dispatch(
        &mut self,
        message: MultiplexMessage<Self::Out, Body<Self::BodyOut, Self::Error>, Self::Error>,
    ) -> Result<()>;
    fn cancel(&mut self, request_id: RequestId) -> Result<()>;
}
Expand description

Dispatch messages from the transport to the service

Required Associated Types§

Source

type Io

Type of underlying I/O object

Source

type In

Messages written to the transport

Source

type BodyIn

Inbound body frame

Source

type Out

Messages read from the transport

Source

type BodyOut

Outbound body frame

Source

type Error: From<Error>

Transport error

Source

type Stream: Stream<Item = Self::BodyIn, Error = Self::Error>

Inbound body stream type

Source

type Transport: Transport<Self::BodyOut, Item = Frame<Self::Out, Self::BodyOut, Self::Error>, SinkItem = Frame<Self::In, Self::BodyIn, Self::Error>>

Transport type

Required Methods§

Source

fn transport(&mut self) -> &mut Self::Transport

Mutable reference to the transport

Source

fn poll( &mut self, ) -> Poll<Option<MultiplexMessage<Self::In, Self::Stream, Self::Error>>, Error>

Poll the next available message

Source

fn poll_ready(&self) -> Async<()>

The Dispatch is ready to accept another message

Source

fn dispatch( &mut self, message: MultiplexMessage<Self::Out, Body<Self::BodyOut, Self::Error>, Self::Error>, ) -> Result<()>

Process an out message

Source

fn cancel(&mut self, request_id: RequestId) -> Result<()>

Cancel interest in the exchange identified by RequestId

Implementors§