Struct wasm_encoder::TypeSection
source · [−]pub struct TypeSection { /* private fields */ }
Expand description
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
sourceimpl TypeSection
impl TypeSection
sourcepub 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,
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,
Define a function type.
sourcepub 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,
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,
Define a module type.
sourcepub fn instance<'a, E>(&mut self, exports: E) -> &mut Self where
E: IntoIterator<Item = (&'a str, EntityType)>,
E::IntoIter: ExactSizeIterator,
pub fn instance<'a, E>(&mut self, exports: E) -> &mut Self where
E: IntoIterator<Item = (&'a str, EntityType)>,
E::IntoIter: ExactSizeIterator,
Define an instance type.
Trait Implementations
sourceimpl Clone for TypeSection
impl Clone for TypeSection
sourcefn clone(&self) -> TypeSection
fn clone(&self) -> TypeSection
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TypeSection
impl Debug for TypeSection
sourceimpl Default for TypeSection
impl Default for TypeSection
sourcefn default() -> TypeSection
fn default() -> TypeSection
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for TypeSection
impl Send for TypeSection
impl Sync for TypeSection
impl Unpin for TypeSection
impl UnwindSafe for TypeSection
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more