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

pub unsafe trait Allocator {
    fn allocate_segment(&mut self, miniumum_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

fn allocate_segment(&mut self, miniumum_size: u32) -> (*mut Word, u32)

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

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

fn pre_drop(&mut self, _segment0_currently_allocated: u32)

Implementors