Expand description
This is a simple crate to read and write binairy data.
§Example:
use bin_buffer::*;
let x = 16u16;
let y = String::from("hello");
let z = (0.0001f64,1.1111f64);
let mut buffer = Vec::new();
x.into_buffer(&mut buffer);
y.copy_into_buffer(&mut buffer);
z.into_buffer(&mut buffer);
let mut buffer = ReadBuffer::from_raw(buffer);
assert_eq!(Some(x), u16::from_buffer(&mut buffer));
assert_eq!(Some(y), String::from_buffer(&mut buffer));
assert_eq!(Some(z), <(f64,f64)>::from_buffer(&mut buffer));
Structs§
- Read
Buffer - Buffer from which we can read.
Traits§
- Bufferable
- Object can be read and written to a Buffer
Functions§
- buffer_
append_ buffer - Just copies the content of the second buffer to the end of the first buffer.
- buffer_
read_ file - Reads a buffer from a file.
- buffer_
write_ file - Writes a buffer to a file. Will create a new file if none exists or overwrite otherwise.
- buffer_
write_ file_ append - Writes a buffer to the end of a file. Will create a new file if none exists.
Type Aliases§
- Buffer
- Buffer: a Vector of bytes