Struct soroban_wasmi::FuelCosts
source · pub struct FuelCosts {
pub base: u64,
pub entity: u64,
pub load: u64,
pub store: u64,
pub call: u64,
/* private fields */
}
Expand description
Type storing all kinds of fuel costs of instructions.
Fields§
§base: u64
The base fuel costs for all instructions.
entity: u64
The fuel cost for instruction operating on Wasm entities.
§Note
A Wasm entitiy is one of func
, global
, memory
or table
.
Those instructions are usually a bit more costly since they need
multiplie indirect accesses through the Wasm instance and store.
load: u64
The fuel cost offset for memory.load
instructions.
store: u64
The fuel cost offset for memory.store
instructions.
call: u64
The fuel cost offset for call
and call_indirect
instructions.
Implementations§
source§impl FuelCosts
impl FuelCosts
sourcepub fn fuel_for_drop_keep(&self, drop_keep: DropKeep) -> u64
pub fn fuel_for_drop_keep(&self, drop_keep: DropKeep) -> u64
Returns the fuel consumption for branches and returns using the given [DropKeep
].
sourcepub fn fuel_for_locals(&self, locals: u64) -> u64
pub fn fuel_for_locals(&self, locals: u64) -> u64
Returns the fuel consumption for calling a function with the amount of local variables.
§Note
Function parameters are also treated as local variables.
sourcepub fn fuel_for_bytes(&self, bytes: u64) -> u64
pub fn fuel_for_bytes(&self, bytes: u64) -> u64
Returns the fuel consumption for processing the amount of memory bytes.
sourcepub fn fuel_for_elements(&self, elements: u64) -> u64
pub fn fuel_for_elements(&self, elements: u64) -> u64
Returns the fuel consumption for processing the amount of table elements.
Trait Implementations§
impl Copy for FuelCosts
Auto Trait Implementations§
impl RefUnwindSafe for FuelCosts
impl Send for FuelCosts
impl Sync for FuelCosts
impl Unpin for FuelCosts
impl UnwindSafe for FuelCosts
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
§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>
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>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.