pub struct BrTable<'a> { /* private fields */ }
Expand description
A br_table entries representation.
Implementations§
Source§impl<'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
use wasmparser::{BinaryReader, Operator};
let buf = [0x0e, 0x02, 0x01, 0x02, 0x00];
let mut reader = BinaryReader::new(&buf, 0);
let op = reader.read_operator().unwrap();
if let Operator::BrTable { targets } = op {
let targets = targets.targets().collect::<Result<Vec<_>, _>>().unwrap();
assert_eq!(targets, [1, 2]);
}
Trait Implementations§
impl Eq for BrTable<'_>
Auto Trait Implementations§
impl<'a> Freeze for BrTable<'a>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more