Struct wasm_encoder::ProducersSection
source · pub struct ProducersSection { /* private fields */ }
Expand description
An encoder for the producers custom section.
This section is a non-standard convention that is supported by many toolchains.
§Example
use wasm_encoder::{ProducersSection, ProducersField, Module};
// Create a new producers section.
let mut field = ProducersField::new();
field.value("clang", "14.0.4");
field.value("rustc", "1.66.1 (90743e729 2023-01-10)");
let mut producers = ProducersSection::new();
producers.field("processed-by", &field);
// Add the producers section to a new Wasm module and get the encoded bytes.
let mut module = Module::new();
module.section(&producers);
let wasm_bytes = module.finish();
Implementations§
source§impl ProducersSection
impl ProducersSection
sourcepub fn field(&mut self, name: &str, values: &ProducersField) -> &mut Self
pub fn field(&mut self, name: &str, values: &ProducersField) -> &mut Self
Add a field to the section. The spec recommends names for this section are “language”, “processed-by”, and “sdk”. Each field in section must have a unique name.
Trait Implementations§
source§impl Clone for ProducersSection
impl Clone for ProducersSection
source§fn clone(&self) -> ProducersSection
fn clone(&self) -> ProducersSection
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 ComponentSection for ProducersSection
impl ComponentSection for ProducersSection
source§impl Debug for ProducersSection
impl Debug for ProducersSection
source§impl Default for ProducersSection
impl Default for ProducersSection
source§impl Encode for ProducersSection
impl Encode for ProducersSection
Auto Trait Implementations§
impl Freeze for ProducersSection
impl RefUnwindSafe for ProducersSection
impl Send for ProducersSection
impl Sync for ProducersSection
impl Unpin for ProducersSection
impl UnwindSafe for ProducersSection
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)