Struct wasm_encoder::CoreTypeSection
source · [−]pub struct CoreTypeSection { /* private fields */ }
Expand description
An encoder for the core type section of WebAssembly components.
Example
use wasm_encoder::{Component, CoreTypeSection, ModuleType};
let mut types = CoreTypeSection::new();
types.module(&ModuleType::new());
let mut component = Component::new();
component.section(&types);
let bytes = component.finish();
Implementations
sourceimpl CoreTypeSection
impl CoreTypeSection
sourcepub fn ty(&mut self) -> CoreTypeEncoder<'_>
pub fn ty(&mut self) -> CoreTypeEncoder<'_>
Encode a type into this section.
The returned encoder must be finished before adding another type.
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 in this type section.
sourcepub fn module(&mut self, ty: &ModuleType) -> &mut Self
pub fn module(&mut self, ty: &ModuleType) -> &mut Self
Define a module type in this type section.
Currently this is only used for core type sections in components.
Trait Implementations
sourceimpl Clone for CoreTypeSection
impl Clone for CoreTypeSection
sourcefn clone(&self) -> CoreTypeSection
fn clone(&self) -> CoreTypeSection
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 ComponentSection for CoreTypeSection
impl ComponentSection for CoreTypeSection
sourceimpl Debug for CoreTypeSection
impl Debug for CoreTypeSection
sourceimpl Default for CoreTypeSection
impl Default for CoreTypeSection
sourcefn default() -> CoreTypeSection
fn default() -> CoreTypeSection
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for CoreTypeSection
impl Send for CoreTypeSection
impl Sync for CoreTypeSection
impl Unpin for CoreTypeSection
impl UnwindSafe for CoreTypeSection
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
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.
sourcefn clone_into(&self, target: &mut T)
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