pub trait AsyncWriteZerocopy {
type BufferReadyFuture<T: IoBuf>: Future<Output = T>;
type VectoredBufferReadyFuture<T: IoVectoredBuf>: Future<Output = T>;
// Required methods
fn write_zerocopy<T>(
&mut self,
buf: T,
) -> impl Future<Output = BufResult<usize, Self::BufferReadyFuture<T>>>
where T: IoBuf;
fn write_zerocopy_vectored<T>(
&mut self,
buf: T,
) -> impl Future<Output = BufResult<usize, Self::VectoredBufferReadyFuture<T>>>
where T: IoVectoredBuf;
}Available on crate feature
io only.Expand description
§AsyncZeroCopyWrite
Async zerocopy write with ownership of a buffer.
Required Associated Types§
Sourcetype BufferReadyFuture<T: IoBuf>: Future<Output = T>
type BufferReadyFuture<T: IoBuf>: Future<Output = T>
The future that will be resolved when the buffer is safe to be reused.
Sourcetype VectoredBufferReadyFuture<T: IoVectoredBuf>: Future<Output = T>
type VectoredBufferReadyFuture<T: IoVectoredBuf>: Future<Output = T>
The future that will be resolved when the vectored buffer is safe to be reused.
Required Methods§
Sourcefn write_zerocopy<T>(
&mut self,
buf: T,
) -> impl Future<Output = BufResult<usize, Self::BufferReadyFuture<T>>>where
T: IoBuf,
fn write_zerocopy<T>(
&mut self,
buf: T,
) -> impl Future<Output = BufResult<usize, Self::BufferReadyFuture<T>>>where
T: 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.
Sourcefn write_zerocopy_vectored<T>(
&mut self,
buf: T,
) -> impl Future<Output = BufResult<usize, Self::VectoredBufferReadyFuture<T>>>where
T: IoVectoredBuf,
fn write_zerocopy_vectored<T>(
&mut self,
buf: T,
) -> impl Future<Output = BufResult<usize, Self::VectoredBufferReadyFuture<T>>>where
T: IoVectoredBuf,
Like write_zerocopy, 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.