Skip to main content

Instructions

Struct Instructions 

Source
pub struct Instructions<'a> { /* private fields */ }
Expand description

A sequence of Wasm instructions which may be instrumented.

Implementations§

Source§

impl<'a> Instructions<'a>

Source

pub fn new( instructions: Vec<(Operator<'a>, usize)>, locals_start: usize, save_offsets: bool, ) -> Self

Source

pub fn get_ops(&self) -> &[Operator<'a>]

Get array of operators (instructions).

Source

pub fn get_flags(&self) -> Option<&[InstrumentationFlag<'a>]>

Get array of instrumentation flags.

Source

pub fn get_ops_mut(&mut self) -> Result<&mut Vec<Operator<'a>>>

Directly mutating the instructions will likely invalidate the instruction flags, so this will Error if the instructions have been instrumented.

Source

pub fn get_instr_flag(&self, idx: usize) -> Option<&InstrumentationFlag<'a>>

Source

pub fn push(&mut self, op: Operator<'a>)

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn add_instr(&mut self, index: usize, op: Operator<'a>) -> bool

Source

pub fn current_mode(&self, index: usize) -> Option<InstrumentationMode>

Source

pub fn set_current_mode(&mut self, index: usize, mode: InstrumentationMode)

Source

pub fn finish_instr(&mut self, index: usize)

Source

pub fn instr_len(&self, index: usize) -> usize

Source

pub fn set_alternate(&mut self, index: usize, alternate: InjectedInstrs<'a>)

Source

pub fn set_block_alt(&mut self, index: usize, block_alt: InjectedInstrs<'a>)

Source

pub fn append_to_tag(&mut self, index: usize, data: Vec<u8>)

Source

pub fn clear_instr(&mut self, idx: usize, mode: InstrumentationMode)

Source

pub fn lookup_pc_offset_for(&self, instr_idx: usize) -> Option<usize>

Trait Implementations§

Source§

impl<'a> Clone for Instructions<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Instructions<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for Instructions<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Instructions<'a>

§

impl<'a> RefUnwindSafe for Instructions<'a>

§

impl<'a> Send for Instructions<'a>

§

impl<'a> Sync for Instructions<'a>

§

impl<'a> Unpin for Instructions<'a>

§

impl<'a> UnsafeUnpin for Instructions<'a>

§

impl<'a> UnwindSafe for Instructions<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.