Struct casper_execution_engine::shared::wasm_config::WasmConfig
source · pub struct WasmConfig {
pub max_memory: u32,
pub max_stack_height: u32,
/* private fields */
}
Expand description
Configuration of the Wasm execution environment.
This structure contains various Wasm execution configuration options, such as memory limits, stack limits and costs.
Fields§
§max_memory: u32
Maximum amount of heap memory (represented in 64kB pages) each contract can use.
max_stack_height: u32
Max stack height (native WebAssembly stack limiter).
Implementations§
source§impl WasmConfig
impl WasmConfig
sourcepub const fn new(
max_memory: u32,
max_stack_height: u32,
opcode_costs: OpcodeCosts,
storage_costs: StorageCosts,
host_function_costs: HostFunctionCosts
) -> Self
pub const fn new( max_memory: u32, max_stack_height: u32, opcode_costs: OpcodeCosts, storage_costs: StorageCosts, host_function_costs: HostFunctionCosts ) -> Self
Creates new Wasm config.
sourcepub fn opcode_costs(&self) -> OpcodeCosts
pub fn opcode_costs(&self) -> OpcodeCosts
Returns opcode costs.
sourcepub fn storage_costs(&self) -> StorageCosts
pub fn storage_costs(&self) -> StorageCosts
Returns storage costs.
sourcepub fn take_host_function_costs(self) -> HostFunctionCosts
pub fn take_host_function_costs(self) -> HostFunctionCosts
Returns host function costs and consumes this object.
Trait Implementations§
source§impl Clone for WasmConfig
impl Clone for WasmConfig
source§fn clone(&self) -> WasmConfig
fn clone(&self) -> WasmConfig
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl DataSize for WasmConfig
impl DataSize for WasmConfig
source§const IS_DYNAMIC: bool = false
const IS_DYNAMIC: bool = false
If
true
, the type has a heap size that can vary at runtime, depending on the actual value.source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
The amount of space a value of the type always occupies. If
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Estimates the size of heap memory taken up by this value. Read more
source§impl Debug for WasmConfig
impl Debug for WasmConfig
source§impl Default for WasmConfig
impl Default for WasmConfig
source§impl<'de> Deserialize<'de> for WasmConfig
impl<'de> Deserialize<'de> for WasmConfig
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Distribution<WasmConfig> for Standard
impl Distribution<WasmConfig> for Standard
source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> WasmConfig
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> WasmConfig
Generate a random value of
T
, using rng
as the source of randomness.source§impl FromBytes for WasmConfig
impl FromBytes for WasmConfig
source§impl PartialEq for WasmConfig
impl PartialEq for WasmConfig
source§fn eq(&self, other: &WasmConfig) -> bool
fn eq(&self, other: &WasmConfig) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for WasmConfig
impl Serialize for WasmConfig
source§impl ToBytes for WasmConfig
impl ToBytes for WasmConfig
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Copy for WasmConfig
impl Eq for WasmConfig
impl StructuralEq for WasmConfig
impl StructuralPartialEq for WasmConfig
Auto Trait Implementations§
impl RefUnwindSafe for WasmConfig
impl Send for WasmConfig
impl Sync for WasmConfig
impl Unpin for WasmConfig
impl UnwindSafe for WasmConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.