Struct wasm_metadata::Producers
source · pub struct Producers(_);
Expand description
A representation of a WebAssembly producers section.
Spec: https://github.com/WebAssembly/tool-conventions/blob/main/ProducersSection.md
Implementations§
source§impl Producers
impl Producers
sourcepub fn from_wasm(bytes: &[u8]) -> Result<Option<Self>>
pub fn from_wasm(bytes: &[u8]) -> Result<Option<Self>>
Read the producers section from a Wasm binary. Supports both core Modules and Components. In the component case, only returns the producers section in the outer component, ignoring all interior components and modules.
sourcepub fn from_reader(section: ProducersSectionReader<'_>) -> Result<Self>
pub fn from_reader(section: ProducersSectionReader<'_>) -> Result<Self>
Read the producers section from a Wasm binary.
sourcepub fn add(&mut self, field: &str, name: &str, version: &str)
pub fn add(&mut self, field: &str, name: &str, version: &str)
Add a name & version value to a field.
The spec says expected field names are “language”, “processed-by”, and “sdk”. The version value should be left blank for languages.
sourcepub fn merge(&mut self, other: &Self)
pub fn merge(&mut self, other: &Self)
Add all values found in another Producers
section. Values in other
take
precedence.
sourcepub fn get<'a>(&'a self, field: &str) -> Option<ProducersField<'a>>
pub fn get<'a>(&'a self, field: &str) -> Option<ProducersField<'a>>
Get the contents of a field
sourcepub fn iter<'a>(
&'a self
) -> impl Iterator<Item = (&'a String, ProducersField<'a>)> + 'a
pub fn iter<'a>( &'a self ) -> impl Iterator<Item = (&'a String, ProducersField<'a>)> + 'a
Iterate through all fields
sourcepub fn section(&self) -> ProducersSection
pub fn section(&self) -> ProducersSection
Serialize into wasm_encoder::ProducersSection
.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Producers
impl Send for Producers
impl Sync for Producers
impl Unpin for Producers
impl UnwindSafe for Producers
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