Trait AsyncWriteOwned
pub trait AsyncWriteOwned {
// Required methods
fn poll_write_owned<B>(
&mut self,
cx: &mut Context<'_>,
slot: &mut BufSlot<B>,
) -> Poll<Result<usize, Error>>
where B: IoBuf;
fn poll_flush_owned(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>;
fn poll_shutdown_owned(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>;
// Provided methods
fn is_write_vectored_owned(&self) -> bool { ... }
fn write_owned<B>(
&mut self,
buf: B,
) -> impl Future<Output = (Result<usize, Error>, B)> + Send
where B: IoBuf,
Self: Send { ... }
fn flush_owned(&mut self) -> impl Future<Output = Result<(), Error>> + Send
where Self: Send { ... }
fn shutdown_owned(
&mut self,
) -> impl Future<Output = Result<(), Error>> + Send
where Self: Send { ... }
}Expand description
Write bytes from an owned buffer, returning the buffer with the result.
Required Methods§
fn poll_write_owned<B>(
&mut self,
cx: &mut Context<'_>,
slot: &mut BufSlot<B>,
) -> Poll<Result<usize, Error>>where
B: IoBuf,
fn poll_write_owned<B>(
&mut self,
cx: &mut Context<'_>,
slot: &mut BufSlot<B>,
) -> Poll<Result<usize, Error>>where
B: IoBuf,
The primitive. Poll a write of the initialized bytes [0, buf_len)
of the buffer in slot, returning the bytes written. The buffer is moved
through the write op (readiness: borrowed-then-restored; completion /
SEND_ZC: moved into the op, slot left InFlight, returned on the NOTIF) and
left back in slot on Ready. The caller advances its own cursor by the
returned count.
Provided Methods§
fn is_write_vectored_owned(&self) -> bool
fn is_write_vectored_owned(&self) -> bool
Hint whether vectored writes are efficient on this writer (mirrors
[tokio::io::AsyncWrite::is_write_vectored]), lets a frame encoder pick a
chain threshold. Defaults to false, the blanket-over-tokio impl and thin
adapters forward the underlying writer’s answer.
fn write_owned<B>(
&mut self,
buf: B,
) -> impl Future<Output = (Result<usize, Error>, B)> + Send
fn write_owned<B>( &mut self, buf: B, ) -> impl Future<Output = (Result<usize, Error>, B)> + Send
Derived async convenience over poll_write_owned:
move buf in, issue one write, hand it back with the bytes written. Not
a second impl: every owned writer gets it for free.
async fn write(buf) -> BufResult is the primitive completion runtimes
(compio / monoio) settled on. We keep it derived rather than primitive
because a manual Future::poll consumer (e.g. hyper’s connection core)
can’t drive an async fn without boxing its future, so poll_write_owned
stays the real primitive.
fn flush_owned(&mut self) -> impl Future<Output = Result<(), Error>> + Sendwhere
Self: Send,
fn flush_owned(&mut self) -> impl Future<Output = Result<(), Error>> + Sendwhere
Self: Send,
Derived async flush over poll_flush_owned.
fn shutdown_owned(&mut self) -> impl Future<Output = Result<(), Error>> + Sendwhere
Self: Send,
fn shutdown_owned(&mut self) -> impl Future<Output = Result<(), Error>> + Sendwhere
Self: Send,
Derived async shutdown over poll_shutdown_owned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".