pub struct Imbalance<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> { /* private fields */ }
Expand description
An imbalance in the system, representing a divergence of recorded token supply from the sum of
the balances of all accounts. This is must_use
in order to ensure it gets handled (placing
into an account, settling from an account or altering the supply).
Importantly, it has a special Drop
impl, and cannot be created outside of this module.
Implementations§
source§impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> Imbalance<A, B, OnDrop, OppositeOnDrop>
impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> Imbalance<A, B, OnDrop, OppositeOnDrop>
pub fn zero(asset: A) -> Self
pub fn drop_zero(self) -> Result<(), Self>
pub fn split(self, amount: B) -> (Self, Self)
pub fn merge(self, other: Self) -> Result<Self, (Self, Self)>
pub fn subsume(&mut self, other: Self) -> Result<(), Self>
pub fn offset( self, other: Imbalance<A, B, OppositeOnDrop, OnDrop> ) -> Result<SameOrOther<Self, Imbalance<A, B, OppositeOnDrop, OnDrop>>, (Self, Imbalance<A, B, OppositeOnDrop, OnDrop>)>
pub fn peek(&self) -> B
pub fn asset(&self) -> A
Trait Implementations§
source§impl<A, B, OnDrop, OppositeOnDrop> Debug for Imbalance<A, B, OnDrop, OppositeOnDrop>where
A: Debug + AssetId,
B: Debug + Balance,
OnDrop: Debug + HandleImbalanceDrop<A, B>,
OppositeOnDrop: Debug + HandleImbalanceDrop<A, B>,
impl<A, B, OnDrop, OppositeOnDrop> Debug for Imbalance<A, B, OnDrop, OppositeOnDrop>where A: Debug + AssetId, B: Debug + Balance, OnDrop: Debug + HandleImbalanceDrop<A, B>, OppositeOnDrop: Debug + HandleImbalanceDrop<A, B>,
source§impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> Drop for Imbalance<A, B, OnDrop, OppositeOnDrop>
impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> Drop for Imbalance<A, B, OnDrop, OppositeOnDrop>
source§impl<A: PartialEq + AssetId, B: PartialEq + Balance, OnDrop: PartialEq + HandleImbalanceDrop<A, B>, OppositeOnDrop: PartialEq + HandleImbalanceDrop<A, B>> PartialEq<Imbalance<A, B, OnDrop, OppositeOnDrop>> for Imbalance<A, B, OnDrop, OppositeOnDrop>
impl<A: PartialEq + AssetId, B: PartialEq + Balance, OnDrop: PartialEq + HandleImbalanceDrop<A, B>, OppositeOnDrop: PartialEq + HandleImbalanceDrop<A, B>> PartialEq<Imbalance<A, B, OnDrop, OppositeOnDrop>> for Imbalance<A, B, OnDrop, OppositeOnDrop>
source§impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> TryDrop for Imbalance<A, B, OnDrop, OppositeOnDrop>
impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> TryDrop for Imbalance<A, B, OnDrop, OppositeOnDrop>
impl<A: Eq + AssetId, B: Eq + Balance, OnDrop: Eq + HandleImbalanceDrop<A, B>, OppositeOnDrop: Eq + HandleImbalanceDrop<A, B>> Eq for Imbalance<A, B, OnDrop, OppositeOnDrop>
impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> StructuralEq for Imbalance<A, B, OnDrop, OppositeOnDrop>
impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> StructuralPartialEq for Imbalance<A, B, OnDrop, OppositeOnDrop>
Auto Trait Implementations§
impl<A, B, OnDrop, OppositeOnDrop> RefUnwindSafe for Imbalance<A, B, OnDrop, OppositeOnDrop>where A: RefUnwindSafe, B: RefUnwindSafe, OnDrop: RefUnwindSafe, OppositeOnDrop: RefUnwindSafe,
impl<A, B, OnDrop, OppositeOnDrop> Send for Imbalance<A, B, OnDrop, OppositeOnDrop>where A: Send, B: Send, OnDrop: Send, OppositeOnDrop: Send,
impl<A, B, OnDrop, OppositeOnDrop> Sync for Imbalance<A, B, OnDrop, OppositeOnDrop>where A: Sync, B: Sync, OnDrop: Sync, OppositeOnDrop: Sync,
impl<A, B, OnDrop, OppositeOnDrop> Unpin for Imbalance<A, B, OnDrop, OppositeOnDrop>where A: Unpin, B: Unpin, OnDrop: Unpin, OppositeOnDrop: Unpin,
impl<A, B, OnDrop, OppositeOnDrop> UnwindSafe for Imbalance<A, B, OnDrop, OppositeOnDrop>where A: UnwindSafe, B: UnwindSafe, OnDrop: UnwindSafe, OppositeOnDrop: UnwindSafe,
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. 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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.