[][src]Struct wasmer_middleware_common::metering::Metering

pub struct Metering { /* fields omitted */ }

Metering is a compiler middleware that calculates the cost of WebAssembly instructions at compile time and will count the cost of executed instructions at runtime. Within the Metering functionality, this instruction cost is called points.

The Metering struct takes a limit parameter which is the maximum number of points which can be used by an instance during a function call. If this limit is exceeded, the function call will trap. Each instance has a points_used field which can be used to track points used during a function call and should be set back to zero after a function call.

Each compiler backend with Metering enabled should produce the same cost used at runtime for the same function calls so we can say that the metering is deterministic.

Methods

impl Metering[src]

pub fn new(limit: u64) -> Metering[src]

Trait Implementations

impl FunctionMiddleware for Metering[src]

type Error = String

The error type for this middleware's functions.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.