pub struct RuntimeBalances { /* private fields */ }
Expand description

Structure to encapsulate asset balances for VM runtime

Implementations

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.

Fetch the balance of a given Id, if set.

Attempt to add the balance of an asset, updating the VM memory in the appropriate offset

Note: This will not append a new asset into the set since all the assets must be created during VM initialization and any additional asset would imply reordering the memory representation of the balances since they must always be ordered, as in the protocol.

Attempt to subtract the balance of an asset, updating the VM memory in the appropriate offset

Write all assets into the VM memory.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Converts to this type from the input type.

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

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

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.