Crate data_buffer
source ·Expand description
This crate defines a buffer data structure optimized to be written to and
read from standard Vec
s. DataBuffer
is particularly useful when dealing
with data whose type is determined at run time.
Re-exports
pub extern crate reinterpret;
Modules
Utility macros for code generation.
Macros
Applies
$fn
to an DataBuffer
mapping valid numeric data types by corresponding generic
parameters. For example, passing an DataBuffer
containing data of type u8
will cause this
macro to call $fn
with type parameter u8
like $fn::<u8>(buffer)
.Structs
Buffer of plain old data (POD). The data is stored as an array of bytes (
Vec<u8>
).
DataBuffer
keeps track of the type stored within via an explicit TypeId
member. 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).