Skip to main content

SplitStream

Trait SplitStream 

Source
pub trait SplitStream: Unpin {
    type Ingress<'i>: AsyncRead + Unpin
       where Self: 'i;
    type Egress<'e>: AsyncWrite + Unpin
       where Self: 'e;

    // Required method
    fn split(&mut self) -> (Self::Ingress<'_>, Self::Egress<'_>);
}
Expand description

Helper trait for efficiently splitting a stream into read and write halves.

Required Associated Types§

Source

type Ingress<'i>: AsyncRead + Unpin where Self: 'i

Associated type for the read half of the stream. These can be a non-owning reference to avoid unnecessary heap allocations and reference counting.

Source

type Egress<'e>: AsyncWrite + Unpin where Self: 'e

Associated type for the write half of the stream. These can be a non-owning reference to avoid unnecessary heap allocations and reference counting.

Required Methods§

Source

fn split(&mut self) -> (Self::Ingress<'_>, Self::Egress<'_>)

Split the stream into non-owning read and write halves.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SplitStream for DuplexEnd

Source§

type Ingress<'i> = &'i mut ReadEnd

Source§

type Egress<'e> = &'e mut WriteEnd

Source§

fn split(&mut self) -> (Self::Ingress<'_>, Self::Egress<'_>)

Source§

impl SplitStream for TcpStream

Source§

type Ingress<'i> = ReadHalf<'i>

Source§

type Egress<'e> = WriteHalf<'e>

Source§

fn split(&mut self) -> (Self::Ingress<'_>, Self::Egress<'_>)

Implementors§