This crate allows reading bytes representation of structs even in presence of padding bytes.
SafeBytes for structures
where all field types are
SafeBytes::safe_bytes would initialize all padding bytes
All primitives implement
SafeBytes as there is no padding bytes.
Additionally some std types implement
Note that in order to initialize padding bytes
SafeBytes::safe_bytes takes mutable reference
And returns shareable reference
&[u8] because not all
bitpatterns may be allowed for the type.
This repository is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.