Expand description
This crate defines a buffer data structure optimized to be written to and read from standard
Vecs. DataBuffer is particularly useful when dealing with data whose type is determined at
run time. Note that data is stored in the underlying byte buffers in native endian form, thus
requesting typed data from a buffer on a platform with different endianness is unsafe.
§Caveats
DataBuffer doesn’t support zero-sized types.
Re-exports§
pub use reinterpret;
Modules§
- macros
- Utility macros for code generation.
Macros§
- call_
numeric_ buffer_ fn - Applies
$fnto anDataBuffermapping valid numeric data types by corresponding generic parameters. For example, passing anDataBuffercontaining data of typeu8will cause this macro to call$fnwith type parameteru8like$fn::<u8>(buffer).
Structs§
- Data
Buffer - Buffer of data. The data is stored as an array of bytes (
Vec<u8>).DataBufferkeeps track of the type stored within via an explicitTypeIdmember. This allows one to hide the type from the compiler and check it only when necessary. It is particularly useful when the type of data is determined at runtime (e.g. when parsing numeric data).