pub struct Module { /* private fields */ }Expand description
A compiled bytecode module.
Instructions are decoded lazily via decode_step.
Cold data (strings, symbols, types) is accessed through view methods.
Implementations§
Source§impl Module
impl Module
Sourcepub fn from_bytes(bytes: Vec<u8>) -> Result<Self, ModuleError>
pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, ModuleError>
Load a module from owned bytes.
Sourcepub fn from_path(path: impl AsRef<Path>) -> Result<Self, ModuleError>
pub fn from_path(path: impl AsRef<Path>) -> Result<Self, ModuleError>
Load a module from a file path.
Sourcepub fn decode_step(&self, step: u16) -> Instruction<'_>
pub fn decode_step(&self, step: u16) -> Instruction<'_>
Decode an instruction at the given step index.
Sourcepub fn strings(&self) -> StringsView<'_>
pub fn strings(&self) -> StringsView<'_>
Get a view into the string table.
Sourcepub fn node_types(&self) -> SymbolsView<'_, NodeSymbol>
pub fn node_types(&self) -> SymbolsView<'_, NodeSymbol>
Get a view into the node type symbols.
Sourcepub fn node_fields(&self) -> SymbolsView<'_, FieldSymbol>
pub fn node_fields(&self) -> SymbolsView<'_, FieldSymbol>
Get a view into the node field symbols.
Sourcepub fn trivia(&self) -> TriviaView<'_>
pub fn trivia(&self) -> TriviaView<'_>
Get a view into the trivia entries.
Sourcepub fn entrypoints(&self) -> EntrypointsView<'_>
pub fn entrypoints(&self) -> EntrypointsView<'_>
Get a view into the entrypoints.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
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