pub struct ModuleConfig { /* private fields */ }Expand description
The configuration for a module.
Implementations§
Source§impl ModuleConfig
impl ModuleConfig
Sourcepub fn set_page_size(&mut self, page_size: u32) -> &mut Self
pub fn set_page_size(&mut self, page_size: u32) -> &mut Self
Sets the page size used for the module.
Default: 4096 (4k)
Sourcepub fn aux_data_size(&self) -> u32
pub fn aux_data_size(&self) -> u32
Returns the size of the auxiliary data region.
Sourcepub fn set_aux_data_size(&mut self, aux_data_size: u32) -> &mut Self
pub fn set_aux_data_size(&mut self, aux_data_size: u32) -> &mut Self
Sets the size of the auxiliary data region.
Default: 0
Sourcepub fn set_gas_metering(&mut self, kind: Option<GasMeteringKind>) -> &mut Self
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
Sourcepub fn dynamic_paging(&self) -> bool
pub fn dynamic_paging(&self) -> bool
Returns whether dynamic paging is enabled.
Sourcepub fn set_dynamic_paging(&mut self, value: bool) -> &mut Self
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
Sourcepub fn set_step_tracing(&mut self, enabled: bool) -> &mut Self
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
Sourcepub fn set_strict(&mut self, is_strict: bool) -> &mut Self
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
Sourcepub fn cache_by_hash(&self) -> bool
pub fn cache_by_hash(&self) -> bool
Returns whether the module will be cached by hash.
Sourcepub fn set_cache_by_hash(&mut self, enabled: bool) -> &mut Self
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
Sourcepub fn set_custom_codegen(
&mut self,
custom_codegen: impl CustomCodegen,
) -> &mut Self
pub fn set_custom_codegen( &mut self, custom_codegen: impl CustomCodegen, ) -> &mut Self
Sets a custom codegen handler.
Sourcepub fn cost_model(&self) -> Option<&CostModelKind>
pub fn cost_model(&self) -> Option<&CostModelKind>
Gets the currently set gas cost model.
Sourcepub fn set_cost_model(&mut self, cost_model: Option<CostModelKind>) -> &mut Self
pub fn set_cost_model(&mut self, cost_model: Option<CostModelKind>) -> &mut Self
Sets a custom gas cost model.
Sourcepub fn per_instruction_metering(&self) -> bool
pub fn per_instruction_metering(&self) -> bool
Returns whether per-instruction gas metering is enabled.
Sourcepub fn set_per_instruction_metering(&mut self, value: bool) -> &mut Self
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
impl Clone for ModuleConfig
Source§fn clone(&self) -> ModuleConfig
fn clone(&self) -> ModuleConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more