pub struct Imbalance<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<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.
Trait Implementations
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> Debug for Imbalance<B, OnDrop, OppositeOnDrop> where
B: Debug,
OnDrop: Debug,
OppositeOnDrop: Debug,
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> Debug for Imbalance<B, OnDrop, OppositeOnDrop> where
B: Debug,
OnDrop: Debug,
OppositeOnDrop: Debug,
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> Default for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> Default for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> Drop for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> Drop for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> Imbalance<B> for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> Imbalance<B> for Imbalance<B, OnDrop, OppositeOnDrop>
The oppositely imbalanced type. They come in pairs.
Drop an instance cleanly. Only works if its self.value()
is zero.
Consume self
and return two independent instances; the first
is guaranteed to be at most amount
and the second will be the remainder. Read more
Consume self
and an other
to return a new instance that combines
both. Read more
Consume an other
to mutate self
into a new instance that combines
both. Read more
fn offset(
self,
other: Imbalance<B, OppositeOnDrop, OnDrop>
) -> SameOrOther<Self, Imbalance<B, OppositeOnDrop, OnDrop>>
fn offset(
self,
other: Imbalance<B, OppositeOnDrop, OnDrop>
) -> SameOrOther<Self, Imbalance<B, OppositeOnDrop, OnDrop>>
Consume self and along with an opposite counterpart to return a combined result. Read more
Consume self
and return two independent instances; the amounts returned will be in
approximately the same ratio as first
:second
. Read more
Consume self and add its two components, defined by the first component’s balance, element-wise to two pre-existing Imbalances. Read more
Consume self and add its two components, defined by the ratio first
:second
,
element-wise to two pre-existing Imbalances. Read more
Consume self and add its two components, defined by the first component’s balance, element-wise into two pre-existing Imbalance refs. Read more
fn ration_merge_into(self, first: u32, second: u32, others: &mut (Self, Self)) where
Balance: From<u32> + Saturating + Div<Output = Balance>,
fn ration_merge_into(self, first: u32, second: u32, others: &mut (Self, Self)) where
Balance: From<u32> + Saturating + Div<Output = Balance>,
Consume self and add its two components, defined by the ratio first
:second
,
element-wise to two pre-existing Imbalances. Read more
Consume self to mutate other
so that it combines both. Just like subsume
, only with
reversed arguments. Read more
Consume self
and maybe an other
to return a new instance that combines
both. Read more
Maybe consume an other
to mutate self
into a new instance that combines
both. Read more
impl<B: PartialEq + Balance, OnDrop: PartialEq + HandleImbalanceDrop<B>, OppositeOnDrop: PartialEq + HandleImbalanceDrop<B>> PartialEq<Imbalance<B, OnDrop, OppositeOnDrop>> for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: PartialEq + Balance, OnDrop: PartialEq + HandleImbalanceDrop<B>, OppositeOnDrop: PartialEq + HandleImbalanceDrop<B>> PartialEq<Imbalance<B, OnDrop, OppositeOnDrop>> for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> TryDrop for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> TryDrop for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Eq + Balance, OnDrop: Eq + HandleImbalanceDrop<B>, OppositeOnDrop: Eq + HandleImbalanceDrop<B>> Eq for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> StructuralEq for Imbalance<B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> StructuralPartialEq for Imbalance<B, OnDrop, OppositeOnDrop>
Auto Trait Implementations
impl<B, OnDrop, OppositeOnDrop> RefUnwindSafe for Imbalance<B, OnDrop, OppositeOnDrop> where
B: RefUnwindSafe,
OnDrop: RefUnwindSafe,
OppositeOnDrop: RefUnwindSafe,
impl<B, OnDrop, OppositeOnDrop> Send for Imbalance<B, OnDrop, OppositeOnDrop> where
B: Send,
OnDrop: Send,
OppositeOnDrop: Send,
impl<B, OnDrop, OppositeOnDrop> Sync for Imbalance<B, OnDrop, OppositeOnDrop> where
B: Sync,
OnDrop: Sync,
OppositeOnDrop: Sync,
impl<B, OnDrop, OppositeOnDrop> Unpin for Imbalance<B, OnDrop, OppositeOnDrop> where
B: Unpin,
OnDrop: Unpin,
OppositeOnDrop: Unpin,
impl<B, OnDrop, OppositeOnDrop> UnwindSafe for Imbalance<B, OnDrop, OppositeOnDrop> where
B: UnwindSafe,
OnDrop: UnwindSafe,
OppositeOnDrop: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘimpl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘimpl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
The counterpart to unchecked_from
.
Consume self to return an equivalent value of T
.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more