Struct fuel_vm::interpreter::RuntimeBalances
source · pub struct RuntimeBalances { /* private fields */ }
Expand description
Structure to encapsulate asset balances for VM runtime
Implementations§
source§impl RuntimeBalances
impl RuntimeBalances
sourcepub fn try_from_iter<T>(iter: T) -> Result<Self, CheckError>where
T: IntoIterator<Item = (AssetId, Word)>,
pub fn try_from_iter<T>(iter: T) -> Result<Self, CheckError>where T: IntoIterator<Item = (AssetId, Word)>,
Attempt to create a set of runtime balances from an iterator of pairs.
This will fail if, and only if, the provided asset/balance pair isn’t consistent or a balance overflows.
sourcepub fn balance(&self, asset: &AssetId) -> Option<Word>
pub fn balance(&self, asset: &AssetId) -> Option<Word>
Fetch the balance of a given Id, if set.
sourcepub fn checked_balance_sub(
&mut self,
memory: &mut [u8; 67108864],
asset: &AssetId,
value: Word
) -> Option<Word>
pub fn checked_balance_sub( &mut self, memory: &mut [u8; 67108864], asset: &AssetId, value: Word ) -> Option<Word>
Attempt to subtract the balance of an asset, updating the VM memory in the appropriate offset
sourcepub fn to_vm<S, Tx>(self, vm: &mut Interpreter<S, Tx>)where
Tx: ExecutableTransaction,
pub fn to_vm<S, Tx>(self, vm: &mut Interpreter<S, Tx>)where Tx: ExecutableTransaction,
Write all assets into the VM memory.
Trait Implementations§
source§impl AsMut<HashMap<AssetId, Balance, RandomState>> for RuntimeBalances
impl AsMut<HashMap<AssetId, Balance, RandomState>> for RuntimeBalances
source§impl AsRef<HashMap<AssetId, Balance, RandomState>> for RuntimeBalances
impl AsRef<HashMap<AssetId, Balance, RandomState>> for RuntimeBalances
source§impl Clone for RuntimeBalances
impl Clone for RuntimeBalances
source§fn clone(&self) -> RuntimeBalances
fn clone(&self) -> RuntimeBalances
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 Debug for RuntimeBalances
impl Debug for RuntimeBalances
source§impl Default for RuntimeBalances
impl Default for RuntimeBalances
source§fn default() -> RuntimeBalances
fn default() -> RuntimeBalances
Returns the “default value” for a type. Read more
source§impl Index<&AssetId> for RuntimeBalances
impl Index<&AssetId> for RuntimeBalances
source§impl PartialEq<RuntimeBalances> for RuntimeBalances
impl PartialEq<RuntimeBalances> for RuntimeBalances
source§impl TryFrom<InitialBalances> for RuntimeBalances
impl TryFrom<InitialBalances> for RuntimeBalances
§type Error = CheckError
type Error = CheckError
The type returned in the event of a conversion error.
source§fn try_from(initial_balances: InitialBalances) -> Result<Self, CheckError>
fn try_from(initial_balances: InitialBalances) -> Result<Self, CheckError>
Performs the conversion.
Auto Trait Implementations§
impl RefUnwindSafe for RuntimeBalances
impl Send for RuntimeBalances
impl Sync for RuntimeBalances
impl Unpin for RuntimeBalances
impl UnwindSafe for RuntimeBalances
Blanket Implementations§
source§impl<T> AnyDebug for Twhere
T: Any + Debug,
impl<T> AnyDebug for Twhere T: Any + Debug,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Returns a reference to the underlying type as
Any
.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