Trait Config

Source
pub trait Config {
    const MAX_VALUE_STACK_SIZE: usize = 983_040usize;
    const MAX_CALL_STACK_SIZE: usize = 4_096usize;

    // Provided method
    fn instruction_hook(&mut self, bytecode: &[u8], pc: usize) { ... }
}
Expand description

Trait that allows user specified configuration for various items during interpretation. Additionally, the types implementing this trait can act as custom user data within an interpreter instance, passed along to each method of this trait and host functions whenever they are invoked.

The default implementation of all trait methods have the least overhead, i. e. most can be optimized out fully.

Provided Associated Constants§

Source

const MAX_VALUE_STACK_SIZE: usize = 983_040usize

Maximum number of values in the value stack

Source

const MAX_CALL_STACK_SIZE: usize = 4_096usize

Maximum number of cascading function invocations

Provided Methods§

Source

fn instruction_hook(&mut self, bytecode: &[u8], pc: usize)

A hook which is called before every wasm instruction

This allows the most intricate insight into the interpreters behavior, at the cost of a hefty performance penalty

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Config for ()

Default implementation of the interpreter configuration, with all hooks empty

Implementors§