Skip to main content

RegionManager

Struct RegionManager 

Source
pub struct RegionManager { /* private fields */ }
Expand description

Manages a hierarchy of memory regions.

Implementations§

Source§

impl RegionManager

Source

pub fn new() -> Self

Create a new region manager.

Source

pub fn current_region_id(&self) -> u64

Get the current active region ID.

Source

pub fn push_region(&mut self) -> u64

Push a new region scope.

Source

pub fn push_region_with_size(&mut self, chunk_size: usize) -> u64

Push a region with a custom size.

Source

pub fn pop_region(&mut self) -> Option<u64>

Pop the current region scope (deactivating it).

Source

pub fn alloc(&mut self, size: usize) -> Option<(u64, ArenaOffset)>

Allocate in the current region.

Source

pub fn get_bytes( &self, region_id: u64, loc: &ArenaOffset, size: usize, ) -> Option<&[u8]>

Get bytes from a specific region.

Source

pub fn reset_region(&mut self, region_id: u64)

Reset a region and all its children.

Source

pub fn get_region(&self, id: u64) -> Option<&Region>

Get a reference to a region.

Source

pub fn get_region_mut(&mut self, id: u64) -> Option<&mut Region>

Get a mutable reference to a region.

Source

pub fn num_regions(&self) -> usize

Number of regions.

Source

pub fn total_bytes_used(&self) -> usize

Total bytes used across all regions.

Source

pub fn total_capacity(&self) -> usize

Total capacity across all regions.

Source

pub fn scope_depth(&self) -> usize

Depth of the current scope stack.

Source

pub fn remove_region(&mut self, region_id: u64)

Remove a region and all its children.

Trait Implementations§

Source§

impl Debug for RegionManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RegionManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.