DataView
The Pod
trait marks types whose values can be safely transmuted between byte arrays of the same size.
The DataView
type defines read and write data APIs to an underlying byte buffer.
Library
This library is available on crates.io.
Documentation can be found on docs.rs.
In your Cargo.toml, put
[dependencies]
dataview = "~1.0"
Examples
// Construct a zero initialized instance
let mut inst: MyType = zeroed;
assert_eq!;
// Use DataView to access the instance
let view = from_mut;
view.write;
// Create a byte view over the instance
assert_eq!;
License
Licensed under MIT License, see license.txt.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.