Skip to main content

SplitIo

Trait SplitIo 

pub trait SplitIo: Sized {
    type ReadHalf: AsyncReadOwned + Send;
    type WriteHalf: AsyncWriteOwned + Send;

    // Required method
    fn split_io(self) -> (Self::ReadHalf, Self::WriteHalf);
}
Expand description

Split an IO into owned read and write halves usable concurrently.

The blanket impl over tokio IO delegates to [tokio::io::split] — whose half-locking already handles concurrent read+write — and the resulting halves are owned for free via the blanket owned impls. An owned-native backend (an io_uring leaf) can implement this directly to split at the ring level.

Required Associated Types§

type ReadHalf: AsyncReadOwned + Send

The owned read half.

type WriteHalf: AsyncWriteOwned + Send

The owned write half.

Required Methods§

fn split_io(self) -> (Self::ReadHalf, Self::WriteHalf)

Split into owned read and write halves.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

§

impl<T> SplitIo for T
where T: AsyncRead + AsyncWrite + Send,

§

type ReadHalf = ReadHalf<T>

§

type WriteHalf = WriteHalf<T>