Expand description
A data view for reading and writing data in a byte array.
use data_view::View;
let mut buf = [0; 16];
buf.write_at(42_u16, 1);
assert_eq!(buf.read_at::<u16>(1), 42);
Panics if the offset is out of bounds.
Reads a value of type E from the data view. where E implements Endian.
use data_view::View;
let mut buf: [u8; 2] = [12, 34];
assert_eq!(buf.read_at::<u8>(0), 12);
assert_eq!(buf.read_at::<u8>(1), 34);
Panics if the offset is out of bounds.
Writes a value of type E to the data view. where E is a type that implements Endian.
use data_view::View;
let mut buf: [u8; 2] = [0; 2];
buf.write_at(12_u8, 0);
buf.write_at(34_u8, 1);
assert_eq!(buf, [12, 34]);
Panics if the offset is out of bounds.