pub struct CodeStore { /* private fields */ }Expand description
The units published before the program runs. It lives in the runtime
beside the heap, not in it, so the main loop can hold &[Insn] across
heap calls; units compiled at run time live in the heap
(DynamicUnits).
Implementations§
Source§impl CodeStore
impl CodeStore
Sourcepub fn publish(&mut self, unit: CodeUnit) -> Result<CodeUnitId, ValidateError>
pub fn publish(&mut self, unit: CodeUnit) -> Result<CodeUnitId, ValidateError>
Validates unit and appends it. Its cache entries are the caller’s:
Runtime::publish reserves them.
Sourcepub fn lookup(&self, id: CodeUnitId) -> Option<&CodeUnit>
pub fn lookup(&self, id: CodeUnitId) -> Option<&CodeUnit>
The unit id, if it is a unit of this store.
Sourcepub fn get(&self, id: CodeUnitId) -> &CodeUnit
pub fn get(&self, id: CodeUnitId) -> &CodeUnit
The static unit id.
pub fn len(&self) -> usize
Sourcepub fn units(&self) -> impl Iterator<Item = (CodeUnitId, &CodeUnit)>
pub fn units(&self) -> impl Iterator<Item = (CodeUnitId, &CodeUnit)>
Every unit with its id, in publication order.
pub fn is_empty(&self) -> bool
Sourcepub fn tree(&self, id: CodeUnitId) -> Vec<CodeUnitId>
pub fn tree(&self, id: CodeUnitId) -> Vec<CodeUnitId>
id and its descendants in pre-order (Units::tree).
Trait Implementations§
Auto Trait Implementations§
impl !Send for CodeStore
impl !Sync for CodeStore
impl Freeze for CodeStore
impl RefUnwindSafe for CodeStore
impl Unpin for CodeStore
impl UnsafeUnpin for CodeStore
impl UnwindSafe for CodeStore
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