pub struct CustomSectionReader<'a> { /* private fields */ }
Expand description
A reader for custom sections of a WebAssembly module.
Implementations§
source§impl<'a> CustomSectionReader<'a>
impl<'a> CustomSectionReader<'a>
sourcepub fn new(
reader: BinaryReader<'a>,
) -> Result<CustomSectionReader<'a>, BinaryReaderError>
pub fn new( reader: BinaryReader<'a>, ) -> Result<CustomSectionReader<'a>, BinaryReaderError>
Constructs a new CustomSectionReader
for the given data and offset.
sourcepub fn data_offset(&self) -> usize
pub fn data_offset(&self) -> usize
The offset, relative to the start of the original module or component,
that the data
payload for this custom section starts at.
sourcepub fn range(&self) -> Range<usize>
pub fn range(&self) -> Range<usize>
The range of bytes that specify this whole custom section (including both the name of this custom section and its data) specified in offsets relative to the start of the byte stream.
sourcepub fn as_known(&self) -> KnownCustom<'a>
pub fn as_known(&self) -> KnownCustom<'a>
Attempts to match and see if this custom section is statically known to
wasmparser
with any known section reader.
This will inspect self.name()
and return a KnownCustom
if the name
matches a known custom section where there is a parser available for it.
This can also be used as a convenience function for creating such
parsers.
If the custom section name is not known, or if a reader could not be
created, then KnownCustom::Unknown
is returned.
Trait Implementations§
source§impl<'a> Clone for CustomSectionReader<'a>
impl<'a> Clone for CustomSectionReader<'a>
source§fn clone(&self) -> CustomSectionReader<'a>
fn clone(&self) -> CustomSectionReader<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'a> Freeze for CustomSectionReader<'a>
impl<'a> RefUnwindSafe for CustomSectionReader<'a>
impl<'a> Send for CustomSectionReader<'a>
impl<'a> Sync for CustomSectionReader<'a>
impl<'a> Unpin for CustomSectionReader<'a>
impl<'a> UnwindSafe for CustomSectionReader<'a>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more