Struct wasmparser::MemorySectionReader
source · pub struct MemorySectionReader<'a> { /* private fields */ }
Implementations
sourceimpl<'a> MemorySectionReader<'a>
impl<'a> MemorySectionReader<'a>
pub fn new(data: &'a [u8], offset: usize) -> Result<MemorySectionReader<'a>>
pub fn original_position(&self) -> usize
pub fn get_count(&self) -> u32
sourcepub fn read(&mut self) -> Result<MemoryType>
pub fn read(&mut self) -> Result<MemoryType>
Reads content of the memory section.
Examples
use wasmparser::ModuleReader;
let mut reader = ModuleReader::new(data).expect("module reader");
let section = reader.read().expect("type section");
let section = reader.read().expect("function section");
let section = reader.read().expect("memory section");
let mut memory_reader = section.get_memory_section_reader().expect("memory section reader");
for _ in 0..memory_reader.get_count() {
let memory = memory_reader.read().expect("memory");
println!("Memory: {:?}", memory);
}
Trait Implementations
sourceimpl<'a> IntoIterator for MemorySectionReader<'a>
impl<'a> IntoIterator for MemorySectionReader<'a>
type Item = Result<MemoryType, BinaryReaderError>
type Item = Result<MemoryType, BinaryReaderError>
The type of the elements being iterated over.
type IntoIter = SectionIteratorLimited<MemorySectionReader<'a>>
type IntoIter = SectionIteratorLimited<MemorySectionReader<'a>>
Which kind of iterator are we turning this into?
sourceimpl<'a> SectionReader for MemorySectionReader<'a>
impl<'a> SectionReader for MemorySectionReader<'a>
sourceimpl<'a> SectionWithLimitedItems for MemorySectionReader<'a>
impl<'a> SectionWithLimitedItems for MemorySectionReader<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for MemorySectionReader<'a>
impl<'a> Send for MemorySectionReader<'a>
impl<'a> Sync for MemorySectionReader<'a>
impl<'a> Unpin for MemorySectionReader<'a>
impl<'a> UnwindSafe for MemorySectionReader<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more