slvm::heap::storage

Struct Storage

Source
pub(super) struct Storage<T: Clone> {
    flags: Vec<u8>,
    vals: Vec<T>,
    capacity: usize,
    live_objects: usize,
    sticky_objects: usize,
    grow_factor: f64,
}

Fields§

§flags: Vec<u8>§vals: Vec<T>§capacity: usize§live_objects: usize§sticky_objects: usize§grow_factor: f64

Implementations§

Source§

impl<T: Clone> Storage<T>

Source

pub fn with_capacity(capacity: usize) -> Self

Source

pub fn get(&self, idx: usize) -> Option<&T>

Source

pub fn get_mut(&mut self, idx: usize) -> Option<&mut T>

Source

pub fn set_grow_factor(&mut self, grow_factor: f64)

Source

pub fn capacity(&self) -> usize

Source

pub fn live_objects(&self) -> usize

Source

pub fn alloc(&mut self, obj: T, flags: u8) -> u32

Source

pub fn clear_marks(&mut self)

Source

pub fn is_live(&self, idx: usize) -> bool

Is the object at index still alive after GC.

Source

pub fn is_mutable(&self, idx: usize) -> bool

Is the object at index mutable.

Source

pub fn immutable(&mut self, idx: usize)

Mark the object at index immutable.

Source

pub fn mark(&mut self, idx: usize)

Source

pub fn is_traced_and_set(&mut self, idx: usize) -> bool

Source

pub fn sticky(&mut self, idx: usize)

Source

pub fn unsticky(&mut self, idx: usize)

Source

pub fn set_all_dead(&mut self, val: T)

For any dead, live bit not set, objects in heap set them to val.

Source

pub fn trace_all_live<FN: FnMut(&T)>(&mut self, trace: FN)

Trait Implementations§

Source§

impl<T: Debug + Clone> Debug for Storage<T>

Source§

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

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

impl<T: Clone> Default for Storage<T>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<T> Freeze for Storage<T>

§

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

§

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

§

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

§

impl<T> Unpin for Storage<T>
where T: Unpin,

§

impl<T> UnwindSafe for Storage<T>
where T: UnwindSafe,

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.