Struct wasm_encoder::TypeSection
source · pub struct TypeSection { /* private fields */ }
Expand description
An encoder for the type section of WebAssembly modules.
Example
use wasm_encoder::{Module, TypeSection, ValType};
let mut types = TypeSection::new();
types.function([ValType::I32, ValType::I32], [ValType::I64]);
let mut module = Module::new();
module.section(&types);
let bytes = module.finish();
Implementations§
source§impl TypeSection
impl TypeSection
sourcepub fn function<P, R>(&mut self, params: P, results: R) -> &mut Selfwhere
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 Selfwhere P: IntoIterator<Item = ValType>, P::IntoIter: ExactSizeIterator, R: IntoIterator<Item = ValType>, R::IntoIter: ExactSizeIterator,
Define a function type in this type section.
sourcepub fn array(&mut self, ty: &StorageType, mutable: bool) -> &mut Self
pub fn array(&mut self, ty: &StorageType, mutable: bool) -> &mut Self
Define an array type in this type section.
Trait Implementations§
source§impl Clone for TypeSection
impl Clone for TypeSection
source§fn clone(&self) -> TypeSection
fn clone(&self) -> TypeSection
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TypeSection
impl Debug for TypeSection
source§impl Default for TypeSection
impl Default for TypeSection
source§fn default() -> TypeSection
fn default() -> TypeSection
Returns the “default value” for a type. Read more
source§impl Encode for TypeSection
impl Encode for TypeSection
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more