pub trait TransportReadHalf: Send + Unpin {
    type Body: Body;

    // Required method
    fn poll_read_msg(
        self: Pin<&mut Self>,
        context: &mut Context<'_>
    ) -> Poll<Result<Message<Self::Body>, TransportError>>;

    // Provided method
    fn read_msg(&mut self) -> ReadMsg<'_, Self> 
       where Self: Unpin { ... }
}
Expand description

Trait for the read half of a transport type.

Required Associated Types§

source

type Body: Body

The body type for messages transferred over the transport.

Required Methods§

source

fn poll_read_msg( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<Message<Self::Body>, TransportError>>

Try to read a message from the transport without blocking.

This function may read partial messages into an internal buffer.

If the function returns Poll::Pending, the current task is scheduled to wake when more data is available.

Provided Methods§

source

fn read_msg(&mut self) -> ReadMsg<'_, Self>
where Self: Unpin,

Asynchronously read a complete message from the transport.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<P> TransportReadHalf for Pin<P>

§

type Body = <<P as Deref>::Target as TransportReadHalf>::Body

source§

fn poll_read_msg( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<Message<Self::Body>, TransportError>>

source§

impl<T> TransportReadHalf for &mut T

§

type Body = <T as TransportReadHalf>::Body

source§

fn poll_read_msg( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<Message<Self::Body>, TransportError>>

source§

impl<T> TransportReadHalf for Box<T>

§

type Body = <T as TransportReadHalf>::Body

source§

fn poll_read_msg( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<Message<Self::Body>, TransportError>>

Implementors§