[−][src]Trait capnp::message::Allocator
An object that allocates memory for a Cap'n Proto message as it is being built.
Required methods
fn allocate_segment(&mut self, minimum_size: u32) -> (*mut u8, u32)
Allocates zeroed memory for a new segment, returning a pointer to the start of the segment and a u32 indicating the length of the segment (in words).
UNSAFETY ALERT: The callee is responsible for ensuring all of the following: 1. the returned memory is initialized to all zeroes, 2. the returned memory is valid for the remaining lifetime of the Allocator object, 3. the memory doesn't overlap with other allocated memory, 4. the memory is 8-byte aligned (or the "unaligned" feature is enabled for the capnp crate).
Provided methods
fn pre_drop(&mut self, _segment0_currently_allocated: u32)
Called before the Allocator is dropped, to allow the first segment to be re-zeroed before possibly being reused in another allocator.