Skip to main content

Heap

Struct Heap 

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

Owns the live-object registry for one JavaScript runtime.

Implementations§

Source§

impl Heap

Source

pub fn new() -> Heap

Create an empty heap. Runs the collector only when asked (see Heap::set_threshold).

Source

pub fn set_threshold(&self, n: usize)

Trigger a collection automatically when more than n boxes are live. usize::MAX disables automatic collection (the default).

Source

pub fn threshold(&self) -> usize

Current automatic-collection threshold.

Source

pub fn live_count(&self) -> usize

Number of live boxes.

Source

pub fn allocated_bytes(&self) -> usize

Approximate number of bytes held by live boxes (excluding external allocations made by the values themselves).

Source

pub fn collect(&self) -> CollectStats

Run the cycle collector.

Objects that are only reachable from garbage are dropped and freed; everything reachable from a handle living outside the heap survives.

Trait Implementations§

Source§

impl Default for Heap

Source§

fn default() -> Heap

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

Auto Trait Implementations§

§

impl !Freeze for Heap

§

impl !RefUnwindSafe for Heap

§

impl !Send for Heap

§

impl !Sync for Heap

§

impl !UnwindSafe for Heap

§

impl Forget for Heap

§

impl Move for Heap

§

impl Unpin for Heap
where *const u8 is !null: Unpin, *const Header is !null: Unpin,

§

impl UnsafeUnpin for Heap

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.