pub struct ComponentExportSection { /* private fields */ }
Expand description
An encoder for the export section of WebAssembly component.
§Example
use wasm_encoder::{Component, ComponentExportSection, ComponentExportKind};
// This exports a function named "foo"
let mut exports = ComponentExportSection::new();
exports.export("foo", ComponentExportKind::Func, 0, None);
let mut component = Component::new();
component.section(&exports);
let bytes = component.finish();
Implementations§
Source§impl ComponentExportSection
impl ComponentExportSection
Sourcepub fn new() -> Self
Available on crate feature component-model
only.
pub fn new() -> Self
component-model
only.Create a new component export 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 exports 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 export(
&mut self,
name: &str,
kind: ComponentExportKind,
index: u32,
ty: Option<ComponentTypeRef>,
) -> &mut Self
Available on crate feature component-model
only.
pub fn export( &mut self, name: &str, kind: ComponentExportKind, index: u32, ty: Option<ComponentTypeRef>, ) -> &mut Self
component-model
only.Define an export in the export section.
Trait Implementations§
Source§impl Clone for ComponentExportSection
Available on crate feature component-model
only.
impl Clone for ComponentExportSection
Available on crate feature
component-model
only.Source§fn clone(&self) -> ComponentExportSection
fn clone(&self) -> ComponentExportSection
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 ComponentExportSection
Available on crate feature component-model
only.
impl ComponentSection for ComponentExportSection
Available on crate feature
component-model
only.Source§impl Debug for ComponentExportSection
Available on crate feature component-model
only.
impl Debug for ComponentExportSection
Available on crate feature
component-model
only.Source§impl Default for ComponentExportSection
Available on crate feature component-model
only.
impl Default for ComponentExportSection
Available on crate feature
component-model
only.Source§fn default() -> ComponentExportSection
fn default() -> ComponentExportSection
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ComponentExportSection
impl RefUnwindSafe for ComponentExportSection
impl Send for ComponentExportSection
impl Sync for ComponentExportSection
impl Unpin for ComponentExportSection
impl UnwindSafe for ComponentExportSection
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