Struct wasmparser::BrTable
source · [−]pub struct BrTable<'a> { /* private fields */ }
Expand description
A br_table entries representation.
Implementations
sourceimpl<'a> BrTable<'a>
impl<'a> BrTable<'a>
sourcepub fn len(&self) -> u32
pub fn len(&self) -> u32
Returns the number of br_table
entries, not including the default
label
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether BrTable
doesn’t have any labels apart from the default one.
sourcepub fn targets(&self) -> BrTableTargets<'_>
pub fn targets(&self) -> BrTableTargets<'_>
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
except the default target. The returned iterator will
yield self.len()
elements.
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, 2]);
}
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for BrTable<'a>
impl<'a> Send for BrTable<'a>
impl<'a> Sync for BrTable<'a>
impl<'a> Unpin for BrTable<'a>
impl<'a> UnwindSafe for BrTable<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
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.
sourcefn clone_into(&self, target: &mut T)
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