pub struct Module {Show 15 fields
pub types: Vec<RecGroup>,
pub imports: Vec<Import>,
pub functions: Vec<Func>,
pub tables: Vec<Table>,
pub memories: Vec<Memory>,
pub tags: Vec<Tag>,
pub globals: Vec<Global>,
pub exports: Vec<Export>,
pub start: Option<u32>,
pub elements: Vec<Element>,
pub data_count: Option<u32>,
pub data: Vec<Data>,
pub bodies: Vec<FuncBody>,
pub names: NameSection,
pub custom_sections: Vec<CustomSection>,
}Expand description
A decoded WebAssembly module.
Fields§
§types: Vec<RecGroup>Type section: recursive type groups.
imports: Vec<Import>Import section.
functions: Vec<Func>Function section: type indices for each function.
tables: Vec<Table>Table section.
memories: Vec<Memory>Memory section.
Tag section.
globals: Vec<Global>Global section.
exports: Vec<Export>Export section.
start: Option<u32>Start function index.
elements: Vec<Element>Element section.
data_count: Option<u32>Data count (from data count section).
data: Vec<Data>Data section.
bodies: Vec<FuncBody>Function bodies (code section).
names: NameSectionParsed name section.
custom_sections: Vec<CustomSection>Other custom sections.
Implementations§
Source§impl Module
impl Module
Sourcepub fn find_closest_item(&self, id: &ItemId) -> Option<&dyn Item>
pub fn find_closest_item(&self, id: &ItemId) -> Option<&dyn Item>
Find the closest enclosing AST item for id.
For most variants this is the item directly identified by the index.
For ItemId::Local it returns the enclosing function.
Sourcepub fn definitions(&self) -> Vec<(ItemId, Span)>
pub fn definitions(&self) -> Vec<(ItemId, Span)>
Return an (ItemId, Span) pair for every definition in the module, in
section order. Locals are excluded.
Source§impl Module
impl Module
Sourcepub fn decode_with_options(
bytes: &[u8],
options: &DecodeOptions,
) -> Result<Module>
pub fn decode_with_options( bytes: &[u8], options: &DecodeOptions, ) -> Result<Module>
Decode a wasm binary with the given options.
Sourcepub fn decode_function(
&mut self,
idx: usize,
bytes: &[u8],
) -> Result<&FuncBodyDef>
pub fn decode_function( &mut self, idx: usize, bytes: &[u8], ) -> Result<&FuncBodyDef>
Decode a single function body, storing the result back into the module. For lazy
bodies, bytes must be the original module binary that was passed to decode.
Returns a reference to the stored definition.
Trait Implementations§
impl Eq for Module
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.