pub enum BalanceResult {
RootNotFound,
Success {
purse_addr: URefAddr,
total_balance: U512,
available_balance: U512,
proofs_result: ProofsResult,
},
Failure(TrackingCopyError),
}Expand description
Result enum that represents all possible outcomes of a balance request.
Variants§
RootNotFound
Returned if a passed state root hash is not found.
Success
A query returned a balance.
Fields
§
proofs_result: ProofsResultProofs result.
Failure(TrackingCopyError)
Failure.
Implementations§
Source§impl BalanceResult
impl BalanceResult
Sourcepub fn purse_addr(&self) -> Option<URefAddr>
pub fn purse_addr(&self) -> Option<URefAddr>
Returns the purse address for a BalanceResult::Success variant.
Sourcepub fn total_balance(&self) -> Option<&U512>
pub fn total_balance(&self) -> Option<&U512>
Returns the total balance for a BalanceResult::Success variant.
Sourcepub fn available_balance(&self) -> Option<&U512>
pub fn available_balance(&self) -> Option<&U512>
Returns the available balance for a BalanceResult::Success variant.
Sourcepub fn proofs_result(self) -> Option<ProofsResult>
pub fn proofs_result(self) -> Option<ProofsResult>
Returns the Merkle proofs, if any.
Sourcepub fn is_sufficient(&self, cost: U512) -> bool
pub fn is_sufficient(&self, cost: U512) -> bool
Is the available balance sufficient to cover the cost?
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Was the balance request successful?
Sourcepub fn error(&self) -> Option<&TrackingCopyError>
pub fn error(&self) -> Option<&TrackingCopyError>
Tracking copy error, if any.
Trait Implementations§
Source§impl Clone for BalanceResult
impl Clone for BalanceResult
Source§fn clone(&self) -> BalanceResult
fn clone(&self) -> BalanceResult
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 BalanceResult
impl Debug for BalanceResult
Source§impl From<Error> for BalanceResult
impl From<Error> for BalanceResult
Source§fn from(tce: TrackingCopyError) -> Self
fn from(tce: TrackingCopyError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for BalanceResult
impl RefUnwindSafe for BalanceResult
impl Send for BalanceResult
impl Sync for BalanceResult
impl Unpin for BalanceResult
impl UnwindSafe for BalanceResult
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<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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more