ModuleConfig

Struct ModuleConfig 

Source
pub struct ModuleConfig { /* private fields */ }
Expand description

The configuration for a module.

Implementations§

Source§

impl ModuleConfig

Source

pub fn new() -> Self

Creates a new default module configuration.

Source

pub fn set_page_size(&mut self, page_size: u32) -> &mut Self

Sets the page size used for the module.

Default: 4096 (4k)

Source

pub fn aux_data_size(&self) -> u32

Returns the size of the auxiliary data region.

Source

pub fn set_aux_data_size(&mut self, aux_data_size: u32) -> &mut Self

Sets the size of the auxiliary data region.

Default: 0

Source

pub fn set_gas_metering(&mut self, kind: Option<GasMeteringKind>) -> &mut Self

Sets the type of gas metering to enable for this module.

Default: None

Source

pub fn dynamic_paging(&self) -> bool

Returns whether dynamic paging is enabled.

Source

pub fn set_dynamic_paging(&mut self, value: bool) -> &mut Self

Sets whether dynamic paging is enabled.

Config::allow_dynamic_paging also needs to be true for dynamic paging to be enabled.

Default: false

Source

pub fn set_step_tracing(&mut self, enabled: bool) -> &mut Self

Sets whether step tracing is enabled.

When enabled InterruptKind::Step will be returned by RawInstance::run for each executed instruction.

Should only be used for debugging.

Default: false

Source

pub fn set_strict(&mut self, is_strict: bool) -> &mut Self

Sets the strict mode. When disabled it’s guaranteed that the semantics of lazy execution match the semantics of eager execution.

Should only be used for debugging.

Default: false

Source

pub fn cache_by_hash(&self) -> bool

Returns whether the module will be cached by hash.

Source

pub fn set_cache_by_hash(&mut self, enabled: bool) -> &mut Self

Sets whether the module will be cached by hash.

This introduces extra overhead as every time a module compilation is triggered the hash of the program must be calculated, and in general it is faster to recompile a module from scratch rather than compile its hash.

Default: true

Source

pub fn set_custom_codegen( &mut self, custom_codegen: impl CustomCodegen, ) -> &mut Self

Sets a custom codegen handler.

Source

pub fn cost_model(&self) -> Option<&CostModelKind>

Gets the currently set gas cost model.

Source

pub fn set_cost_model(&mut self, cost_model: Option<CostModelKind>) -> &mut Self

Sets a custom gas cost model.

Source

pub fn per_instruction_metering(&self) -> bool

Returns whether per-instruction gas metering is enabled.

Source

pub fn set_per_instruction_metering(&mut self, value: bool) -> &mut Self

Sets whether per-instruction gas metering is enabled.

This can only be used with the interpreter and with the default gas cost model. This option is DEPRECATED and will be removed in the future!

Default: false

Trait Implementations§

Source§

impl Clone for ModuleConfig

Source§

fn clone(&self) -> ModuleConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ModuleConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.