pub trait Write {
// Required method
fn write(&mut self, buf: &[u8]) -> Result<usize>;
// Provided methods
fn write_all(&mut self, buf: &[u8]) -> Result<()> { ... }
fn write_str(&mut self, s: &str) -> Result<()> { ... }
fn write_fmt(&mut self, args: Arguments<'_>) -> Result<()> { ... }
}Expand description
A trait for objects which are byte-oriented sinks.
This is very similar to the standard library’s io::Write and share similiarities with fmt::Write.
This trait is intended to be implemented for custom types used in no_std development.
Required Methods§
Sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written.
This function will attempt to write the entire contents of buf, but the entire write may not succeed, or the write may also generate an error. A call to write represents at most one attempt to write to any wrapped object.
Provided Methods§
Sourcefn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this write.
This method will continously call write untill there is no more data or an error of non Error::BufferExhausted kind is returned.