Struct wasmparser::OperatorsReader
source · [−]pub struct OperatorsReader<'a> { /* private fields */ }
Implementations
sourceimpl<'a> OperatorsReader<'a>
impl<'a> OperatorsReader<'a>
pub fn eof(&self) -> bool
pub fn original_position(&self) -> usize
pub fn ensure_end(&self) -> Result<()>
pub fn read<'b>(&mut self) -> Result<Operator<'b>> where
'a: 'b,
pub fn into_iter_with_offsets<'b>(self) -> OperatorsIteratorWithOffsets<'b>ⓘNotable traits for OperatorsIteratorWithOffsets<'a>impl<'a> Iterator for OperatorsIteratorWithOffsets<'a> type Item = Result<(Operator<'a>, usize)>;
where
'a: 'b,
pub fn read_with_offset<'b>(&mut self) -> Result<(Operator<'b>, usize)> where
'a: 'b,
Trait Implementations
sourceimpl<'a> Clone for OperatorsReader<'a>
impl<'a> Clone for OperatorsReader<'a>
sourcefn clone(&self) -> OperatorsReader<'a>
fn clone(&self) -> OperatorsReader<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> IntoIterator for OperatorsReader<'a>
impl<'a> IntoIterator for OperatorsReader<'a>
sourcefn into_iter(self) -> Self::IntoIter
fn into_iter(self) -> Self::IntoIter
Reads content of the code section.
Examples
use wasmparser::{Operator, CodeSectionReader, Result};
let mut code_reader = CodeSectionReader::new(data, 0).unwrap();
for _ in 0..code_reader.get_count() {
let body = code_reader.read().expect("function body");
let mut op_reader = body.get_operators_reader().expect("op reader");
let ops = op_reader.into_iter().collect::<Result<Vec<Operator>>>().expect("ops");
assert!(
if let [Operator::Nop, Operator::End] = ops.as_slice() { true } else { false },
"found {:?}",
ops
);
}
type IntoIter = OperatorsIterator<'a>
type IntoIter = OperatorsIterator<'a>
Which kind of iterator are we turning this into?
Auto Trait Implementations
impl<'a> RefUnwindSafe for OperatorsReader<'a>
impl<'a> Send for OperatorsReader<'a>
impl<'a> Sync for OperatorsReader<'a>
impl<'a> Unpin for OperatorsReader<'a>
impl<'a> UnwindSafe for OperatorsReader<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more