Skip to main content

AsyncWriteAncillaryZerocopy

Trait AsyncWriteAncillaryZerocopy 

pub trait AsyncWriteAncillaryZerocopy {
    type BufferReadyFuture<T: IoBuf, C: IoBuf>: Future<Output = (T, C)>;
    type VectoredBufferReadyFuture<T: IoVectoredBuf, C: IoBuf>: Future<Output = (T, C)>;

    // Required methods
    fn write_zerocopy_with_ancillary<T, C>(
        &mut self,
        buf: T,
        control: C,
    ) -> impl Future<Output = BufResult<usize, Self::BufferReadyFuture<T, C>>>
       where T: IoBuf,
             C: IoBuf;
    fn write_zerocopy_vectored_with_ancillary<T, C>(
        &mut self,
        buf: T,
        control: C,
    ) -> impl Future<Output = BufResult<usize, Self::VectoredBufferReadyFuture<T, C>>>
       where T: IoVectoredBuf,
             C: IoBuf;
}
Available on crate features io and ancillary only.
Expand description

Trait for zerocopy asynchronous write with ancillary (control) data. Intended for connected stream sockets (TCP, Unix streams) where no destination address is needed.

Required Associated Types§

type BufferReadyFuture<T: IoBuf, C: IoBuf>: Future<Output = (T, C)>

The future that will be resolved when the buffer is safe to be reused.

type VectoredBufferReadyFuture<T: IoVectoredBuf, C: IoBuf>: Future<Output = (T, C)>

The future that will be resolved when the vectored buffer is safe to be reused.

Required Methods§

fn write_zerocopy_with_ancillary<T, C>( &mut self, buf: T, control: C, ) -> impl Future<Output = BufResult<usize, Self::BufferReadyFuture<T, C>>>
where T: IoBuf, C: IoBuf,

Write some bytes from buffer into this source using the underlying zero-copy mechanism. It returns a result of the underlying write operation and a future that will be resolved when the buffer is safe to be reused.

fn write_zerocopy_vectored_with_ancillary<T, C>( &mut self, buf: T, control: C, ) -> impl Future<Output = BufResult<usize, Self::VectoredBufferReadyFuture<T, C>>>
where T: IoVectoredBuf, C: IoBuf,

Like write_zerocopy_with_ancillary, except that it writes from a buffer implements IoVectoredBuf into the source.

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.

Implementations on Foreign Types§

§

impl<A> AsyncWriteAncillaryZerocopy for &mut A

Implementors§

§

impl AsyncWriteAncillaryZerocopy for &TcpStream

§

type BufferReadyFuture<T: IoBuf, C: IoBuf> = Extract<Zerocopy<SendMsg<[T; 1], C, SharedFd<Socket>>>, T, C>

§

type VectoredBufferReadyFuture<T: IoVectoredBuf, C: IoBuf> = Zerocopy<SendMsg<T, C, SharedFd<Socket>>>

§

impl AsyncWriteAncillaryZerocopy for &UnixStream

§

type BufferReadyFuture<T: IoBuf, C: IoBuf> = Extract<Zerocopy<SendMsg<[T; 1], C, SharedFd<Socket>>>, T, C>

§

type VectoredBufferReadyFuture<T: IoVectoredBuf, C: IoBuf> = Zerocopy<SendMsg<T, C, SharedFd<Socket>>>

§

impl AsyncWriteAncillaryZerocopy for TcpStream

§

type BufferReadyFuture<T: IoBuf, C: IoBuf> = Extract<Zerocopy<SendMsg<[T; 1], C, SharedFd<Socket>>>, T, C>

§

type VectoredBufferReadyFuture<T: IoVectoredBuf, C: IoBuf> = Zerocopy<SendMsg<T, C, SharedFd<Socket>>>

§

impl AsyncWriteAncillaryZerocopy for UnixStream

§

type BufferReadyFuture<T: IoBuf, C: IoBuf> = Extract<Zerocopy<SendMsg<[T; 1], C, SharedFd<Socket>>>, T, C>

§

type VectoredBufferReadyFuture<T: IoVectoredBuf, C: IoBuf> = Zerocopy<SendMsg<T, C, SharedFd<Socket>>>

§

impl<A, Alloc> AsyncWriteAncillaryZerocopy for Box<A, Alloc>