Type Alias wasmtime_environ::wasmparser::ComponentInstanceSectionReader
source · pub type ComponentInstanceSectionReader<'a> = SectionLimited<'a, ComponentInstance<'a>>;
Expand description
A reader for the component instance section of a WebAssembly component.
Examples
use wasmparser::ComponentInstanceSectionReader;
let mut reader = ComponentInstanceSectionReader::new(data, 0).unwrap();
for inst in reader {
println!("Instance {:?}", inst.expect("instance"));
}
Aliased Type§
struct ComponentInstanceSectionReader<'a> { /* private fields */ }
Implementations§
source§impl<'a, T> SectionLimited<'a, T>
impl<'a, T> SectionLimited<'a, T>
sourcepub fn new(
data: &'a [u8],
offset: usize
) -> Result<SectionLimited<'a, T>, BinaryReaderError>
pub fn new( data: &'a [u8], offset: usize ) -> Result<SectionLimited<'a, T>, BinaryReaderError>
Creates a new section reader from the provided contents.
The data
provided here is the data of the section itself that will be
parsed. The offset
argument is the byte offset, in the original wasm
binary, that the section was found. The offset
argument is used
for error reporting.
Errors
Returns an error if a 32-bit count couldn’t be read from the data
.
sourcepub fn original_position(&self) -> usize
pub fn original_position(&self) -> usize
Returns whether the original byte offset of this section.
sourcepub fn range(&self) -> Range<usize> ⓘ
pub fn range(&self) -> Range<usize> ⓘ
Returns the range, as byte offsets, of this section within the original wasm binary.
sourcepub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> ⓘwhere
T: FromReader<'a>,
pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> ⓘwhere T: FromReader<'a>,
Returns an iterator which yields not only each item in this section but additionally the offset of each item within the section.
Trait Implementations§
source§impl<T> Clone for SectionLimited<'_, T>
impl<T> Clone for SectionLimited<'_, T>
source§fn clone(&self) -> SectionLimited<'_, T>
fn clone(&self) -> SectionLimited<'_, T>
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<T> Debug for SectionLimited<'_, T>
impl<T> Debug for SectionLimited<'_, T>
source§impl<'a, T> IntoIterator for SectionLimited<'a, T>where
T: FromReader<'a>,
impl<'a, T> IntoIterator for SectionLimited<'a, T>where T: FromReader<'a>,
§type Item = Result<T, BinaryReaderError>
type Item = Result<T, BinaryReaderError>
The type of the elements being iterated over.
§type IntoIter = SectionLimitedIntoIter<'a, T>
type IntoIter = SectionLimitedIntoIter<'a, T>
Which kind of iterator are we turning this into?
source§fn into_iter(self) -> <SectionLimited<'a, T> as IntoIterator>::IntoIter
fn into_iter(self) -> <SectionLimited<'a, T> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more