pub trait WriteExt: Write {
// Provided methods
fn write_buf<B>(&mut self, buf: B) -> Result<(), Self::Error>
where B: Buf { ... }
fn write_buf_all<B>(&mut self, buf: B) -> Result<(), Self::Error>
where B: Buf { ... }
fn flush(&mut self) -> Result<(), Self::Error> { ... }
fn by_ref(&mut self) -> &mut Self
where Self: Sized { ... }
fn transaction(
self,
kind: WriteTransactionKind<'_>,
) -> WriteTransactionVariant<'_, Self>
where Self: Sized { ... }
}Expand description
Write bytes to a writer.
Extension trait for all Write types.
Provided Methods§
Sourcefn write_buf<B>(&mut self, buf: B) -> Result<(), Self::Error>where
B: Buf,
fn write_buf<B>(&mut self, buf: B) -> Result<(), Self::Error>where
B: Buf,
Write buf to the writer advancing it appropriately.
Sourcefn write_buf_all<B>(&mut self, buf: B) -> Result<(), Self::Error>where
B: Buf,
fn write_buf_all<B>(&mut self, buf: B) -> Result<(), Self::Error>where
B: Buf,
Write buf to the writer advancing it until all of it has been written.
This method will try to write buf repeatedly until either a) buf has
no more data, b) an error occurs, c) the writer cannot accept any more bytes.
Sourcefn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Flush this writer ensuring all bytes reach their destination.
Sourcefn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Create a “by reference” adapter that takes the current instance of Write
by mutable reference.
Sourcefn transaction(
self,
kind: WriteTransactionKind<'_>,
) -> WriteTransactionVariant<'_, Self>where
Self: Sized,
Available on crate feature alloc only.
fn transaction(
self,
kind: WriteTransactionKind<'_>,
) -> WriteTransactionVariant<'_, Self>where
Self: Sized,
alloc only.Create a transaction that uses this writer.
This is a convenience wrapper for: WriteTransactionVariant::new()
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.