pub struct Balance { /* private fields */ }Expand description
A signed balance of assets, to represent a balance with negative values such as the results of a transaction from the perspective of a wallet.
Implementations§
Source§impl Balance
impl Balance
Sourcepub fn to_json(&self) -> Result<JsValue, Error>
pub fn to_json(&self) -> Result<JsValue, Error>
Convert the balance to a JsValue for serialization
Note: the amounts are strings since JSON.stringify cannot handle BigInts.
Use entries() to get the raw data.
Sourcepub fn entries(&self) -> Result<JsValue, Error>
pub fn entries(&self) -> Result<JsValue, Error>
Returns the balance as an array of [key, value] pairs.
Sourcepub fn to_string_js(&self) -> String
pub fn to_string_js(&self) -> String
Return the string representation of the balance.
Trait Implementations§
Source§impl From<SignedBalance> for Balance
impl From<SignedBalance> for Balance
Source§fn from(inner: SignedBalance) -> Self
fn from(inner: SignedBalance) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for Balance
impl FromWasmAbi for Balance
Source§impl IntoWasmAbi for Balance
impl IntoWasmAbi for Balance
Source§impl LongRefFromWasmAbi for Balance
impl LongRefFromWasmAbi for Balance
Source§impl OptionFromWasmAbi for Balance
impl OptionFromWasmAbi for Balance
Source§impl OptionIntoWasmAbi for Balance
impl OptionIntoWasmAbi for Balance
Source§impl RefFromWasmAbi for Balance
impl RefFromWasmAbi for Balance
Source§impl RefMutFromWasmAbi for Balance
impl RefMutFromWasmAbi for Balance
Source§impl TryFromJsValue for Balance
impl TryFromJsValue for Balance
Source§impl VectorFromWasmAbi for Balance
impl VectorFromWasmAbi for Balance
Source§impl VectorIntoWasmAbi for Balance
impl VectorIntoWasmAbi for Balance
impl Eq for Balance
impl StructuralPartialEq for Balance
impl SupportsConstructor for Balance
impl SupportsInstanceProperty for Balance
impl SupportsStaticProperty for Balance
Auto Trait Implementations§
impl Freeze for Balance
impl RefUnwindSafe for Balance
impl Send for Balance
impl Sync for Balance
impl Unpin for Balance
impl UnwindSafe for Balance
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§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 Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.