BumpAllocatorArena

Trait BumpAllocatorArena 

Source
pub trait BumpAllocatorArena {
    // Required methods
    fn start(&self) -> *const u8;
    fn size(&self) -> usize;
    fn ensure_min_size(
        &self,
        min_size: usize,
    ) -> BumpAllocatorArenaResult<usize>;

    // Provided method
    fn past_end(&self, ptr: *const u8) -> Option<usize> { ... }
}
Expand description

Trait to model a consecutive chunk of linear memory for bump allocators.

Required Methods§

Source

fn start(&self) -> *const u8

Returns the first pointer in the arena.

Source

fn size(&self) -> usize

Returns the current size of the arena in bytes.

Source

fn ensure_min_size(&self, min_size: usize) -> BumpAllocatorArenaResult<usize>

Ensures that the arena is at least min_size bytes big, or returns an error if that is not possible.

Provided Methods§

Source

fn past_end(&self, ptr: *const u8) -> Option<usize>

Returns the number of bytes ptr is pointing past the end of the arena. Returns None if ptr is not pointing past the end.

Implementations on Foreign Types§

Source§

impl BumpAllocatorArena for &[u8]

Implementors§