[][src]Struct wasm_encoder::TypeSection

pub struct TypeSection { /* fields omitted */ }

An encoder for the type section.

Example

use wasm_encoder::{Module, TypeSection, ValType};

let mut types = TypeSection::new();
let params = vec![ValType::I32, ValType::I64];
let results = vec![ValType::I32];
types.function(params, results);

let mut module = Module::new();
module.section(&types);

let wasm_bytes = module.finish();

Implementations

impl TypeSection[src]

pub fn new() -> TypeSection[src]

Create a new type section encoder.

pub fn function<P, R>(&mut self, params: P, results: R) -> &mut Self where
    P: IntoIterator<Item = ValType>,
    P::IntoIter: ExactSizeIterator,
    R: IntoIterator<Item = ValType>,
    R::IntoIter: ExactSizeIterator
[src]

Define a function type.

pub fn module<'a, I, E>(&mut self, imports: I, exports: E) -> &mut Self where
    I: IntoIterator<Item = (&'a str, Option<&'a str>, EntityType)>,
    I::IntoIter: ExactSizeIterator,
    E: IntoIterator<Item = (&'a str, EntityType)>,
    E::IntoIter: ExactSizeIterator
[src]

Define a module type.

pub fn instance<'a, E>(&mut self, exports: E) -> &mut Self where
    E: IntoIterator<Item = (&'a str, EntityType)>,
    E::IntoIter: ExactSizeIterator
[src]

Define an instance type.

Trait Implementations

impl Section for TypeSection[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, 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.