pub struct StructBuf<T: Struct> { /* fields omitted */ }
A container holding a single flatdata struct in memory, and providing read
and write access to it.
Used in combination with ArchiveBuilder
to serialize single struct
resources, cf. coappearances example.
A struct buffer derefs (const and mut) to a reference of the underlying
struct, therefore, struct getters and setters can be used directly on
buffer.
use flatdata::StructBuf;
define_struct!(A, AMut, "no_schema", 4,
(x, set_x, u32, 0, 16),
(y, set_y, u32, 16, 16)
);
let mut a = StructBuf::<A>::new();
a.set_x(1);
a.set_y(2);
assert_eq!(a.x(), 1);
assert_eq!(a.y(), 2);
Creates an empty struct buffer.
All fields are set to 0.
Returns a raw bytes representation of the buffer.
Formats the value using the given formatter. Read more
Returns the "default value" for a type. Read more
The resulting type after dereferencing.
Mutably dereferences the value.