pub struct RegionManager { /* private fields */ }Expand description
Manages a hierarchy of memory regions.
Implementations§
Source§impl RegionManager
impl RegionManager
Sourcepub fn current_region_id(&self) -> u64
pub fn current_region_id(&self) -> u64
Get the current active region ID.
Sourcepub fn push_region(&mut self) -> u64
pub fn push_region(&mut self) -> u64
Push a new region scope.
Sourcepub fn push_region_with_size(&mut self, chunk_size: usize) -> u64
pub fn push_region_with_size(&mut self, chunk_size: usize) -> u64
Push a region with a custom size.
Sourcepub fn pop_region(&mut self) -> Option<u64>
pub fn pop_region(&mut self) -> Option<u64>
Pop the current region scope (deactivating it).
Sourcepub fn alloc(&mut self, size: usize) -> Option<(u64, ArenaOffset)>
pub fn alloc(&mut self, size: usize) -> Option<(u64, ArenaOffset)>
Allocate in the current region.
Sourcepub fn get_bytes(
&self,
region_id: u64,
loc: &ArenaOffset,
size: usize,
) -> Option<&[u8]>
pub fn get_bytes( &self, region_id: u64, loc: &ArenaOffset, size: usize, ) -> Option<&[u8]>
Get bytes from a specific region.
Sourcepub fn reset_region(&mut self, region_id: u64)
pub fn reset_region(&mut self, region_id: u64)
Reset a region and all its children.
Sourcepub fn get_region(&self, id: u64) -> Option<&Region>
pub fn get_region(&self, id: u64) -> Option<&Region>
Get a reference to a region.
Sourcepub fn get_region_mut(&mut self, id: u64) -> Option<&mut Region>
pub fn get_region_mut(&mut self, id: u64) -> Option<&mut Region>
Get a mutable reference to a region.
Sourcepub fn num_regions(&self) -> usize
pub fn num_regions(&self) -> usize
Number of regions.
Sourcepub fn total_bytes_used(&self) -> usize
pub fn total_bytes_used(&self) -> usize
Total bytes used across all regions.
Sourcepub fn total_capacity(&self) -> usize
pub fn total_capacity(&self) -> usize
Total capacity across all regions.
Sourcepub fn scope_depth(&self) -> usize
pub fn scope_depth(&self) -> usize
Depth of the current scope stack.
Sourcepub fn remove_region(&mut self, region_id: u64)
pub fn remove_region(&mut self, region_id: u64)
Remove a region and all its children.
Trait Implementations§
Source§impl Debug for RegionManager
impl Debug for RegionManager
Auto Trait Implementations§
impl Freeze for RegionManager
impl RefUnwindSafe for RegionManager
impl Send for RegionManager
impl Sync for RegionManager
impl Unpin for RegionManager
impl UnsafeUnpin for RegionManager
impl UnwindSafe for RegionManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more