Trait il2_iltags::io::Writer [−][src]
pub trait Writer {
fn write(&mut self, value: u8) -> Result<()>;
fn as_writer(&mut self) -> &mut dyn Writer;
fn write_all(&mut self, buff: &[u8]) -> Result<()> { ... }
}
Expand description
The Writer
trait allows the addition of bytes into the destination.
It differs from most IO library as it defines all operations as all-or-nothing operations. No partial writes are allowed.
Implementations of this trait are not required to be thread-safe.
Required methods
Writes a single byte.
Arguments:
value
: The value to be written;
Returns:
Ok(())
: On success;Err(ErrorKind)
: In case of error;
Provided methods
Writes a byte slice. As this default implementation
calls write()
multiple times, so it is strongly recommended
that each implementation provides a more efficient version for
this method if possible.
Arguments:
buff
: The value to be written;
Returns:
Ok(())
: On success;Err(ErrorKind)
: In case of error;