pub struct ConstantCostRules { /* private fields */ }
Expand description

A type that implements Rules so that every instruction costs the same.

This is a simplification that is mostly useful for development and testing.

Note

In a production environment it usually makes no sense to assign every instruction the same cost. A proper implemention of Rules should be prived that is probably created by benchmarking.

Implementations

Create a new ConstantCostRules.

Uses instruction_cost for every instruction and memory_grow_cost to dynamically meter the memory growth instruction.

Trait Implementations

Uses instruction cost of 1 and disables memory growth instrumentation.

Returns the cost for the passed instruction. Read more

Returns the costs for growing the memory using the memory.grow instruction. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.