pub enum BalanceHoldResult {
RootNotFound,
BlockTimeNotFound,
Success {
holds: Option<Vec<BalanceHoldAddr>>,
total_balance: Box<U512>,
available_balance: Box<U512>,
hold: Box<U512>,
held: Box<U512>,
effects: Box<Effects>,
},
Failure(BalanceHoldError),
}Expand description
Result enum that represents all possible outcomes of a balance hold request.
Variants§
RootNotFound
Returned if a passed state root hash is not found.
BlockTimeNotFound
Returned if global state does not have an entry for block time.
Success
Balance hold successfully placed.
Fields
§
holds: Option<Vec<BalanceHoldAddr>>Hold addresses, if any.
Failure(BalanceHoldError)
Failed to place balance hold.
Implementations§
Source§impl BalanceHoldResult
impl BalanceHoldResult
Sourcepub fn success(
holds: Option<Vec<BalanceHoldAddr>>,
total_balance: U512,
available_balance: U512,
hold: U512,
held: U512,
effects: Effects,
) -> Self
pub fn success( holds: Option<Vec<BalanceHoldAddr>>, total_balance: U512, available_balance: U512, hold: U512, held: U512, effects: Effects, ) -> Self
Success ctor.
Sourcepub fn total_balance(&self) -> Option<&U512>
pub fn total_balance(&self) -> Option<&U512>
Returns the total balance for a BalanceHoldResult::Success variant.
Sourcepub fn available_balance(&self) -> Option<&U512>
pub fn available_balance(&self) -> Option<&U512>
Returns the available balance for a BalanceHoldResult::Success variant.
Sourcepub fn held(&self) -> Option<&U512>
pub fn held(&self) -> Option<&U512>
Returns the held amount for a BalanceHoldResult::Success variant.
Sourcepub fn holds(&self) -> Option<Vec<BalanceHoldAddr>>
pub fn holds(&self) -> Option<Vec<BalanceHoldAddr>>
Hold address, if any.
Sourcepub fn is_fully_covered(&self) -> bool
pub fn is_fully_covered(&self) -> bool
Was the hold fully covered?
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Was the hold successful?
Sourcepub fn is_root_not_found(&self) -> bool
pub fn is_root_not_found(&self) -> bool
Was the root not found?
Sourcepub fn error_message(&self) -> String
pub fn error_message(&self) -> String
Error message.
Trait Implementations§
Source§impl Debug for BalanceHoldResult
impl Debug for BalanceHoldResult
Source§impl From<BalanceFailure> for BalanceHoldResult
impl From<BalanceFailure> for BalanceHoldResult
Source§fn from(be: BalanceFailure) -> Self
fn from(be: BalanceFailure) -> Self
Converts to this type from the input type.
Source§impl From<Error> for BalanceHoldResult
impl From<Error> for BalanceHoldResult
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 BalanceHoldResult
impl RefUnwindSafe for BalanceHoldResult
impl Send for BalanceHoldResult
impl Sync for BalanceHoldResult
impl Unpin for BalanceHoldResult
impl UnwindSafe for BalanceHoldResult
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> 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