Struct wasmtime_environ::wasm::wasmparser::BrTable [−][src]
pub struct BrTable<'a> { /* fields omitted */ }
Expand description
A br_table entries representation.
Implementations
Returns the number of br_table
entries, not including the default
label
Returns whether BrTable
doesn’t have any labels apart from the default one.
Returns the list of targets that this br_table
instruction will be
jumping to.
This method will return an iterator which parses each target of this
br_table
as well as the default target. The returned iterator will
yield self.len() + 1
elements.
Each iterator item is a tuple of (u32, bool)
, where the first item is
the relative depth of the jump and the second item is true
if the item
is the default label. You’re guaranteed that true
will only show up
for the final element of the iterator.
#Examples
let buf = [0x0e, 0x02, 0x01, 0x02, 0x00]; let mut reader = wasmparser::BinaryReader::new(&buf); let op = reader.read_operator().unwrap(); if let wasmparser::Operator::BrTable { table } = op { let targets = table.targets().collect::<Result<Vec<_>, _>>().unwrap(); assert_eq!(targets, [(1, false), (2, false), (0, true)]); }
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for BrTable<'a>
impl<'a> UnwindSafe for BrTable<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more