gear_wasm_instrument

Struct InstrumentationBuilder

Source
pub struct InstrumentationBuilder<'a, R, GetRulesFn>
where R: Rules, GetRulesFn: FnMut(&Module) -> R,
{ /* private fields */ }
Expand description

This is an auxiliary builder that allows to instrument WASM module.

Implementations§

Source§

impl<'a, R, GetRulesFn> InstrumentationBuilder<'a, R, GetRulesFn>
where R: Rules, GetRulesFn: FnMut(&Module) -> R,

Source

pub fn new(module_name: &'a str) -> Self

Creates a new InstrumentationBuilder with the given module name to import syscalls.

Source

pub fn with_stack_limiter( &mut self, stack_limit: u32, export_stack_height: bool, ) -> &mut Self

Whether to insert a stack limiter into WASM module.

Source

pub fn with_gas_limiter(&mut self, get_gas_rules: GetRulesFn) -> &mut Self

Whether to insert a gas limiter into WASM module.

Source

pub fn instrument( &mut self, module: Module, ) -> Result<Module, InstrumentationError>

Performs instrumentation of a given WASM module depending on the parameters with which the InstrumentationBuilder was created.

Auto Trait Implementations§

§

impl<'a, R, GetRulesFn> Freeze for InstrumentationBuilder<'a, R, GetRulesFn>
where GetRulesFn: Freeze,

§

impl<'a, R, GetRulesFn> RefUnwindSafe for InstrumentationBuilder<'a, R, GetRulesFn>
where GetRulesFn: RefUnwindSafe,

§

impl<'a, R, GetRulesFn> Send for InstrumentationBuilder<'a, R, GetRulesFn>
where GetRulesFn: Send,

§

impl<'a, R, GetRulesFn> Sync for InstrumentationBuilder<'a, R, GetRulesFn>
where GetRulesFn: Sync,

§

impl<'a, R, GetRulesFn> Unpin for InstrumentationBuilder<'a, R, GetRulesFn>
where GetRulesFn: Unpin,

§

impl<'a, R, GetRulesFn> UnwindSafe for InstrumentationBuilder<'a, R, GetRulesFn>
where GetRulesFn: UnwindSafe,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.