[−][src]Struct wast::Module
A parsed WebAssembly module.
Fields
span: Span
Where this module
was defined
name: Option<Id<'a>>
An optional name to refer to this module by.
kind: ModuleKind<'a>
What kind of module this was parsed as.
Methods
impl<'_> Module<'_>
[src]
pub fn encode(&mut self) -> Result<Vec<u8>, Error>
[src]
Encodes this Module
to its binary form.
This function will take the textual representation in Module
and
perform all steps necessary to convert it to a binary WebAssembly
module, suitable for writing to a *.wasm
file. This function may
internally modify the Module
, for example:
-
Name resolution is performed to ensure that
Index::Id
isn't present anywhere in the AST. -
Inline shorthands such as imports/exports/types are all expanded to be dedicated fields of the module.
-
Module fields may be shuffled around to preserve index ordering from expansions.
After all of this expansion has happened the module will be converted to
its binary form and returned as a Vec<u8>
. This is then suitable to
hand off to other wasm runtimes and such.
Errors
This function can return an error for name resolution errors and other expansion-related errors.
Trait Implementations
Auto Trait Implementations
impl<'a> Send for Module<'a>
impl<'a> Sync for Module<'a>
impl<'a> Unpin for Module<'a>
impl<'a> UnwindSafe for Module<'a>
impl<'a> RefUnwindSafe for Module<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,