pub struct ManagedHeap<T>where
T: ManagedObject,{ /* private fields */ }Expand description
Shared heap wrapper and its explicit tracing-or-retain policy. 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> ManagedHeap<T>where
T: ManagedObject,
impl<T> ManagedHeap<T>where
T: ManagedObject,
Sourcepub fn tracing(
cap: usize,
limits: CollectionLimits,
) -> Result<ManagedHeap<T>, ArenaError>
pub fn tracing( cap: usize, limits: CollectionLimits, ) -> Result<ManagedHeap<T>, ArenaError>
Creates a heap which uses bounded tracing collection.
Sourcepub fn retaining(cap: usize) -> Result<ManagedHeap<T>, ArenaError>
pub fn retaining(cap: usize) -> Result<ManagedHeap<T>, ArenaError>
Creates a heap which retains objects until explicit teardown.
Sourcepub fn allocate(&mut self, value: T) -> Result<ManagedHandle, ArenaError>
pub fn allocate(&mut self, value: T) -> Result<ManagedHandle, ArenaError>
Allocates a value after checking the arena capacity and identity space.
Sourcepub fn get(&self, handle: ManagedHandle) -> Result<&T, ArenaError>
pub fn get(&self, handle: ManagedHandle) -> Result<&T, ArenaError>
Returns a shared value reference after validating its handle.
Sourcepub fn get_mut(&mut self, handle: ManagedHandle) -> Result<&mut T, ArenaError>
pub fn get_mut(&mut self, handle: ManagedHandle) -> Result<&mut T, ArenaError>
Returns a mutable value reference after validating its handle.
Sourcepub fn root(
&mut self,
handle: ManagedHandle,
) -> Result<RootedHandle, ArenaError>
pub fn root( &mut self, handle: ManagedHandle, ) -> Result<RootedHandle, ArenaError>
Registers a validated handle as a tracing root.
Sourcepub fn release_root(
&mut self,
rooted: RootedHandle,
) -> Result<ManagedHandle, ArenaError>
pub fn release_root( &mut self, rooted: RootedHandle, ) -> Result<ManagedHandle, ArenaError>
Releases one matching root registration.
Sourcepub const fn policy(&self) -> ManagedHeapPolicy
pub const fn policy(&self) -> ManagedHeapPolicy
Returns the selected reclamation policy.
Sourcepub const fn cycle_leak_gap(&self) -> Option<&'static str>
pub const fn cycle_leak_gap(&self) -> Option<&'static str>
Describes the cycle-reclamation gap when retention is selected.
Sourcepub fn collect(&mut self) -> Result<Option<CollectionReceipt>, CollectionError>
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.
Sourcepub fn teardown(&mut self) -> TeardownReceipt
pub fn teardown(&mut self) -> TeardownReceipt
Removes every object and root, returning deterministic teardown evidence.
Trait Implementations§
Source§impl JavascriptHeapExt for ManagedHeap<ManagedNode<JavascriptManagedKind>>
impl JavascriptHeapExt for ManagedHeap<ManagedNode<JavascriptManagedKind>>
Source§fn connect(
&mut self,
from: ManagedHandle,
to: ManagedHandle,
) -> Result<EdgeId, JavascriptManagedMutationError>
fn connect( &mut self, from: ManagedHandle, to: ManagedHandle, ) -> Result<EdgeId, JavascriptManagedMutationError>
Source§fn connect_weak(
&mut self,
from: ManagedHandle,
to: ManagedHandle,
) -> Result<EdgeId, JavascriptManagedMutationError>
fn connect_weak( &mut self, from: ManagedHandle, to: ManagedHandle, ) -> Result<EdgeId, JavascriptManagedMutationError>
Source§fn connect_ephemeron(
&mut self,
from: ManagedHandle,
key: ManagedHandle,
value: ManagedHandle,
) -> Result<EdgeId, JavascriptManagedMutationError>
fn connect_ephemeron( &mut self, from: ManagedHandle, key: ManagedHandle, value: ManagedHandle, ) -> Result<EdgeId, JavascriptManagedMutationError>
Source§impl PythonHeapExt for ManagedHeap<ManagedNode<PythonManagedKind>>
impl PythonHeapExt for ManagedHeap<ManagedNode<PythonManagedKind>>
Source§fn connect(
&mut self,
from: ManagedHandle,
to: ManagedHandle,
) -> Result<EdgeId, PythonManagedMutationError>
fn connect( &mut self, from: ManagedHandle, to: ManagedHandle, ) -> Result<EdgeId, PythonManagedMutationError>
Source§fn connect_weak(
&mut self,
from: ManagedHandle,
to: ManagedHandle,
) -> Result<EdgeId, PythonManagedMutationError>
fn connect_weak( &mut self, from: ManagedHandle, to: ManagedHandle, ) -> Result<EdgeId, PythonManagedMutationError>
Source§fn connect_ephemeron(
&mut self,
from: ManagedHandle,
key: ManagedHandle,
value: ManagedHandle,
) -> Result<EdgeId, PythonManagedMutationError>
fn connect_ephemeron( &mut self, from: ManagedHandle, key: ManagedHandle, value: ManagedHandle, ) -> Result<EdgeId, PythonManagedMutationError>
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> 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more