[][src]Trait capnp::message::Allocator

pub unsafe trait Allocator {
    fn allocate_segment(&mut self, minimum_size: u32) -> (*mut Word, u32);

    fn pre_drop(&mut self, _segment0_currently_allocated: u32) { ... }

An object that allocates memory for a Cap'n Proto message as it is being built.

Required Methods

Allocates memory for a new segment, returning a pointer to the start of the segment and a u32 indicating the length of the segment.

The allocated memory MUST be initialized to all zeroes.

UNSAFETY ALERT: The callee is responsible for ensuring that the returned memory is valid for the lifetime of the object and doesn't overlap with other allocated memory.

Provided Methods


impl Allocator for HeapAllocator

impl<'a, 'b: 'a> Allocator for ScratchSpaceHeapAllocator<'a, 'b>