pub trait IoEncodeExt: Encode {
// Provided methods
fn encode_to_write_buf<B>(&mut self, buf: &mut WriteBuf<B>) -> Result<()>
where B: AsMut<[u8]> { ... }
fn encode_to_write_buf_async<B>(
&mut self,
buf: &mut WriteBuf<B>,
cx: &mut Context<'_>,
) -> Result<()>
where B: AsMut<[u8]> { ... }
fn encode_all<W: Write>(&mut self, writer: W) -> Result<()> { ... }
}
Expand description
An extension of Encode
trait to aid encodings involving I/O.
Provided Methods§
Sourcefn encode_to_write_buf<B>(&mut self, buf: &mut WriteBuf<B>) -> Result<()>
fn encode_to_write_buf<B>(&mut self, buf: &mut WriteBuf<B>) -> Result<()>
Encodes the items remaining in the encoder and writes the encoded bytes to the given write buffer.
Sourcefn encode_to_write_buf_async<B>(
&mut self,
buf: &mut WriteBuf<B>,
cx: &mut Context<'_>,
) -> Result<()>
fn encode_to_write_buf_async<B>( &mut self, buf: &mut WriteBuf<B>, cx: &mut Context<'_>, ) -> Result<()>
Encodes the items remaining in the encoder and
writes the encoded bytes to the given write buffer.
If the write buffer is full and the writing cannot be performed,
the given WriteBuf will memorize cx’s Waker
.
This Waker
’s wake
will later be called when the WriteBuf
regains its free space.
Sourcefn encode_all<W: Write>(&mut self, writer: W) -> Result<()>
fn encode_all<W: Write>(&mut self, writer: W) -> Result<()>
Encodes all of the items remaining in the encoder and writes the encoded bytes to the given writer.
Note that this is a blocking method.
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.