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.ty().module(&ModuleType::new());
let mut component = Component::new();
component.section(&types);
let bytes = component.finish();
Implementations§
Source§impl CoreTypeSection
impl CoreTypeSection
Sourcepub fn new() -> Self
Available on crate feature component-model
only.
pub fn new() -> Self
component-model
only.Create a new core type section encoder.
Sourcepub fn len(&self) -> u32
Available on crate feature component-model
only.
pub fn len(&self) -> u32
component-model
only.The number of types in the section.
Sourcepub fn is_empty(&self) -> bool
Available on crate feature component-model
only.
pub fn is_empty(&self) -> bool
component-model
only.Determines if the section is empty.
Sourcepub fn ty(&mut self) -> ComponentCoreTypeEncoder<'_>
Available on crate feature component-model
only.
pub fn ty(&mut self) -> ComponentCoreTypeEncoder<'_>
component-model
only.Encode a type into this section.
The returned encoder must be finished before adding another type.
Trait Implementations§
Source§impl Clone for CoreTypeSection
Available on crate feature component-model
only.
impl Clone for CoreTypeSection
Available on crate feature
component-model
only.Source§fn clone(&self) -> CoreTypeSection
fn clone(&self) -> CoreTypeSection
Returns a duplicate 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 ComponentSection for CoreTypeSection
Available on crate feature component-model
only.
impl ComponentSection for CoreTypeSection
Available on crate feature
component-model
only.Source§impl Debug for CoreTypeSection
Available on crate feature component-model
only.
impl Debug for CoreTypeSection
Available on crate feature
component-model
only.Source§impl Default for CoreTypeSection
Available on crate feature component-model
only.
impl Default for CoreTypeSection
Available on crate feature
component-model
only.Source§fn default() -> CoreTypeSection
fn default() -> CoreTypeSection
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CoreTypeSection
impl RefUnwindSafe for CoreTypeSection
impl Send for CoreTypeSection
impl Sync for CoreTypeSection
impl Unpin for CoreTypeSection
impl UnwindSafe for CoreTypeSection
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