Skip to main content

ManagedHeap

Struct ManagedHeap 

Source
pub struct ManagedHeap<T: ManagedObject> { /* private fields */ }
Expand description

A dependency-correct managed heap composed from an arena and reclamation policy.

The wrapper is generic over the guest payload and lives beside the collector, so guest runtimes do not need to duplicate policy or lifecycle behavior.

Implementations§

Source§

impl<T: ManagedObject> ManagedHeap<T>

Source

pub fn tracing(cap: usize, limits: CollectionLimits) -> Result<Self, ArenaError>

Creates a heap which uses bounded tracing collection.

Source

pub fn retaining(cap: usize) -> Result<Self, ArenaError>

Creates a heap which retains objects until explicit teardown.

Source

pub fn allocate(&mut self, value: T) -> Result<ManagedHandle, ArenaError>

Allocates a value after checking the arena capacity and identity space.

Source

pub fn get(&self, handle: ManagedHandle) -> Result<&T, ArenaError>

Returns a shared value reference after validating its handle.

Source

pub fn get_mut(&mut self, handle: ManagedHandle) -> Result<&mut T, ArenaError>

Returns a mutable value reference after validating its handle.

Source

pub fn handle(&self, id: ManagedId) -> Result<ManagedHandle, ArenaError>

Resolves a live managed identity to its generation-checked handle.

Source

pub fn root( &mut self, handle: ManagedHandle, ) -> Result<RootedHandle, ArenaError>

Registers a validated handle as a tracing root.

Source

pub fn release_root( &mut self, rooted: RootedHandle, ) -> Result<ManagedHandle, ArenaError>

Releases one matching root registration.

Source

pub fn live_len(&self) -> usize

Returns the number of live managed allocations.

Source

pub const fn policy(&self) -> ManagedHeapPolicy

Returns the selected reclamation policy.

Source

pub const fn cycle_leak_gap(&self) -> Option<&'static str>

Describes the cycle-reclamation gap when retention is selected.

Source

pub fn collect(&mut self) -> Result<Option<CollectionReceipt>, CollectionError>

Runs the configured reclamation policy at a safepoint.

Retaining heaps return None without mutating the arena.

Source

pub fn teardown(&mut self) -> TeardownReceipt

Removes every object and root, returning deterministic teardown evidence.

Auto Trait Implementations§

§

impl<T> Freeze for ManagedHeap<T>

§

impl<T> RefUnwindSafe for ManagedHeap<T>
where T: RefUnwindSafe,

§

impl<T> Send for ManagedHeap<T>
where T: Send,

§

impl<T> Sync for ManagedHeap<T>
where T: Sync,

§

impl<T> Unpin for ManagedHeap<T>

§

impl<T> UnsafeUnpin for ManagedHeap<T>

§

impl<T> UnwindSafe for ManagedHeap<T>
where T: RefUnwindSafe,

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.