[][src]Struct wasm_encoder::Module

pub struct Module { /* fields omitted */ }

A Wasm module that is being encoded.

Implementations

impl Module[src]

pub fn new() -> Self[src]

Begin writing a new Module.

pub fn section(&mut self, section: &impl Section) -> &mut Self[src]

Write a section into this module.

It is your responsibility to define the sections in the proper order, and to ensure that each kind of section (other than custom sections) is only defined once. While this is a potential footgun, it also allows you to use this crate to easily construct test cases for bad Wasm module encodings.

pub fn as_slice(&self) -> &[u8][src]

Get the encoded Wasm module as a slice.

pub fn finish(self) -> Vec<u8>[src]

Finish writing this Wasm module and extract ownership of the encoded bytes.

Trait Implementations

impl Clone for Module[src]

impl Debug for Module[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.