Struct finite_wasm::Analysis

source ·
pub struct Analysis<StackConfig, GasCostModel> { /* private fields */ }
Expand description

The entry-point type to set-up your finite-wasm analysis.

This type allows running any number of analyses implemented by this crate. By default, none of the analyses are run. Each can be enabled individually with methods such as Self::with_stack or Self::with_gas.

Examples

See the crate root for an example.

Implementations§

source§

impl Analysis<NoConfig, NoConfig>

source

pub fn new() -> Self

source§

impl<StackConfig, GasCostModel> Analysis<StackConfig, GasCostModel>

source

pub fn with_stack<NewSC>( self, max_stack_cfg: NewSC ) -> Analysis<NewSC, GasCostModel>

Configure the stack analysis.

You most likely want to pass in a type that implements the max_stack::SizeConfig trait. This can be either by value, by reference or as a dynamic object of some sort.

source

pub fn with_gas<NewGC>(self, gas_cfg: NewGC) -> Analysis<StackConfig, NewGC>

Configure the gas analysis.

You most likely want to pass in a type that implements the wasmparser::VisitOperator trait. This can be either by value, by reference or as a dynamic object of some sort. Though do keep in mind, that using a dynamic object may incur a significant performance penality, as the configuration provided here is accessed for each instruction in the analyzed module.

For more information see gas::Config.

source§

impl<'b, SC: Config<'b>, GC: Config<'b>> Analysis<SC, GC>

source

pub fn analyze(&mut self, module: &'b [u8]) -> Result<AnalysisOutcome, Error>

Execute the analysis on the provided module.

Auto Trait Implementations§

§

impl<StackConfig, GasCostModel> RefUnwindSafe for Analysis<StackConfig, GasCostModel>where GasCostModel: RefUnwindSafe, StackConfig: RefUnwindSafe,

§

impl<StackConfig, GasCostModel> Send for Analysis<StackConfig, GasCostModel>where GasCostModel: Send, StackConfig: Send,

§

impl<StackConfig, GasCostModel> Sync for Analysis<StackConfig, GasCostModel>where GasCostModel: Sync, StackConfig: Sync,

§

impl<StackConfig, GasCostModel> Unpin for Analysis<StackConfig, GasCostModel>where GasCostModel: Unpin, StackConfig: Unpin,

§

impl<StackConfig, GasCostModel> UnwindSafe for Analysis<StackConfig, GasCostModel>where GasCostModel: UnwindSafe, StackConfig: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.