wast

Enum WastDirective

Source
pub enum WastDirective<'a> {
Show 15 variants Module(QuoteWat<'a>), ModuleDefinition(QuoteWat<'a>), ModuleInstance { span: Span, instance: Option<Id<'a>>, module: Option<Id<'a>>, }, AssertMalformed { span: Span, module: QuoteWat<'a>, message: &'a str, }, AssertInvalid { span: Span, module: QuoteWat<'a>, message: &'a str, }, Register { span: Span, name: &'a str, module: Option<Id<'a>>, }, Invoke(WastInvoke<'a>), AssertTrap { span: Span, exec: WastExecute<'a>, message: &'a str, }, AssertReturn { span: Span, exec: WastExecute<'a>, results: Vec<WastRet<'a>>, }, AssertExhaustion { span: Span, call: WastInvoke<'a>, message: &'a str, }, AssertUnlinkable { span: Span, module: Wat<'a>, message: &'a str, }, AssertException { span: Span, exec: WastExecute<'a>, }, AssertSuspension { span: Span, exec: WastExecute<'a>, message: &'a str, }, Thread(WastThread<'a>), Wait { span: Span, thread: Id<'a>, },
}
Expand description

The different kinds of directives found in a *.wast file.

Some more information about these various branches can be found at https://github.com/WebAssembly/spec/blob/main/interpreter/README.md#scripts.

Variants§

§

Module(QuoteWat<'a>)

The provided module is defined, validated, and then instantiated.

§

ModuleDefinition(QuoteWat<'a>)

The provided module is defined and validated.

This module is not instantiated automatically.

§

ModuleInstance

The named module is instantiated under the instance name provided.

Fields

§span: Span
§instance: Option<Id<'a>>
§module: Option<Id<'a>>
§

AssertMalformed

Asserts the module cannot be decoded with the given error.

Fields

§span: Span
§module: QuoteWat<'a>
§message: &'a str
§

AssertInvalid

Asserts the module cannot be validated with the given error.

Fields

§span: Span
§module: QuoteWat<'a>
§message: &'a str
§

Register

Registers the module instance with the given name to be available for importing in future module instances.

Fields

§span: Span
§name: &'a str
§module: Option<Id<'a>>
§

Invoke(WastInvoke<'a>)

Invokes the specified export.

§

AssertTrap

The invocation provided should trap with the specified error.

Fields

§span: Span
§exec: WastExecute<'a>
§message: &'a str
§

AssertReturn

The invocation provided should succeed with the specified results.

Fields

§span: Span
§exec: WastExecute<'a>
§results: Vec<WastRet<'a>>
§

AssertExhaustion

The invocation provided should exhaust system resources (e.g. stack overflow).

Fields

§span: Span
§call: WastInvoke<'a>
§message: &'a str
§

AssertUnlinkable

The provided module should fail to link when instantiation is attempted.

Fields

§span: Span
§module: Wat<'a>
§message: &'a str
§

AssertException

The invocation provided should throw an exception.

Fields

§span: Span
§exec: WastExecute<'a>
§

AssertSuspension

The invocation should fail to handle a suspension.

Fields

§span: Span
§exec: WastExecute<'a>
§message: &'a str
§

Thread(WastThread<'a>)

Creates a new system thread which executes the given commands.

§

Wait

Waits for the specified thread to exit.

Fields

§span: Span
§thread: Id<'a>

Implementations§

Source§

impl WastDirective<'_>

Source

pub fn span(&self) -> Span

Returns the location in the source that this directive was defined at

Trait Implementations§

Source§

impl<'a> Debug for WastDirective<'a>

Source§

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

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

impl<'a> Parse<'a> for WastDirective<'a>

Source§

fn parse(parser: Parser<'a>) -> Result<Self>

Attempts to parse Self from parser, returning an error if it could not be parsed. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for WastDirective<'a>

§

impl<'a> RefUnwindSafe for WastDirective<'a>

§

impl<'a> Send for WastDirective<'a>

§

impl<'a> Sync for WastDirective<'a>

§

impl<'a> Unpin for WastDirective<'a>

§

impl<'a> UnwindSafe for WastDirective<'a>

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.