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
Available on crate feature component-model
only.
impl ComponentSection for ProducersSection
Available on crate feature
component-model
only.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