Struct wasmparser::BinaryReader
source · pub struct BinaryReader<'a> { /* private fields */ }
Expand description
A binary reader of the WebAssembly structures and types.
Implementations
sourceimpl<'a> BinaryReader<'a>
impl<'a> BinaryReader<'a>
sourcepub fn new(data: &[u8]) -> BinaryReader<'_>
pub fn new(data: &[u8]) -> BinaryReader<'_>
Constructs BinaryReader
type.
Examples
let fn_body = &vec![0x41, 0x00, 0x10, 0x00, 0x0B];
let mut reader = wasmparser::BinaryReader::new(fn_body);
while !reader.eof() {
let op = reader.read_operator();
println!("{:?}", op)
}
pub fn new_with_offset(data: &[u8], original_offset: usize) -> BinaryReader<'_>
pub fn original_position(&self) -> usize
pub fn read_type(&mut self) -> Result<Type>
sourcepub fn read_local_count(&mut self) -> Result<usize>
pub fn read_local_count(&mut self) -> Result<usize>
Read a count
indicating the number of times to call read_local_decl
.
sourcepub fn read_local_decl(
&mut self,
locals_total: &mut usize
) -> Result<(u32, Type)>
pub fn read_local_decl(
&mut self,
locals_total: &mut usize
) -> Result<(u32, Type)>
Read a (count, value_type)
declaration of local variables of the same type.
pub fn eof(&self) -> bool
pub fn current_position(&self) -> usize
pub fn bytes_remaining(&self) -> usize
pub fn read_bytes(&mut self, size: usize) -> Result<&'a [u8]>
pub fn read_u32(&mut self) -> Result<u32>
pub fn read_u64(&mut self) -> Result<u64>
pub fn read_u8(&mut self) -> Result<u32>
pub fn read_var_u32(&mut self) -> Result<u32>
pub fn skip_var_32(&mut self) -> Result<()>
pub fn skip_type(&mut self) -> Result<()>
pub fn skip_bytes(&mut self, len: usize) -> Result<()>
pub fn skip_string(&mut self) -> Result<()>
pub fn read_var_i32(&mut self) -> Result<i32>
pub fn read_var_i64(&mut self) -> Result<i64>
pub fn read_f32(&mut self) -> Result<Ieee32>
pub fn read_f64(&mut self) -> Result<Ieee64>
pub fn read_string(&mut self) -> Result<&'a [u8]>
pub fn read_operator(&mut self) -> Result<Operator<'a>>
Trait Implementations
sourceimpl<'a> Clone for BinaryReader<'a>
impl<'a> Clone for BinaryReader<'a>
sourcefn clone(&self) -> BinaryReader<'a>
fn clone(&self) -> BinaryReader<'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 moreAuto Trait Implementations
impl<'a> RefUnwindSafe for BinaryReader<'a>
impl<'a> Send for BinaryReader<'a>
impl<'a> Sync for BinaryReader<'a>
impl<'a> Unpin for BinaryReader<'a>
impl<'a> UnwindSafe for BinaryReader<'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