OwnedReadHalf

Trait OwnedReadHalf 

Source
pub trait OwnedReadHalf:
    AsyncRead
    + Unpin
    + Send
    + Sync
    + 'static {
    type Runtime: RuntimeLite;

    // Required methods
    fn local_addr(&self) -> Result<SocketAddr>;
    fn peer_addr(&self) -> Result<SocketAddr>;
    fn peek(
        &mut self,
        buf: &mut [u8],
    ) -> impl Future<Output = Result<usize>> + Send;
}
Expand description

The abstraction of a owned read half of a TcpStream.

Required Associated Types§

Source

type Runtime: RuntimeLite

The async runtime.

Required Methods§

Source

fn local_addr(&self) -> Result<SocketAddr>

Returns the local address that this stream is bound to.

Source

fn peer_addr(&self) -> Result<SocketAddr>

Returns the remote address that this stream is connected to.

Source

fn peek(&mut self, buf: &mut [u8]) -> impl Future<Output = Result<usize>> + Send

Receives data on the socket from the remote address to which it is connected, without removing that data from the queue.

On success, returns the number of bytes peeked.

Successive calls return the same data. This is accomplished by passing MSG_PEEK as a flag to the underlying recv system call.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§