Crate write_into
source · [−]Expand description
Defines a trait built on top of io::Write
to write things into it.
Instead of writing blanket implementations it is better to use wrappers
with write_into
function because there might be implementation conflicts
(e.g. between WriteInto
for u8
and WriteInto
for any
IntoIterator
).
Example
use write_into::{BigEndian, WriteInto, write_into};
let mut buffer = Vec::new();
write_into(&mut buffer, BigEndian(0xCAFEBABEu32)).unwrap();
assert_eq!(&buffer, &[0xCA, 0xFE, 0xBA, 0xBE]);
Structs
Used to write values in big endian byte order.
Used to write values in little endian byte order.
Traits
Writes value into I/O sink.
Functions
An alias for WriteInto::write_into
for writing write_into(sink, Wrapper(...))
instead of
Wrapper(...).write_into(sink)
.