Struct pallet_balances::PositiveImbalance
source · [−]pub struct PositiveImbalance<T: Config<I>, I: 'static>(_);
Expand description
Opaque, move-only struct with private fields that serves as a token denoting that funds have been created without any equal and opposite accounting.
Implementations
sourceimpl<T: Config<I>, I: 'static> PositiveImbalance<T, I>
impl<T: Config<I>, I: 'static> PositiveImbalance<T, I>
Trait Implementations
sourceimpl<T: Config<I>, I: 'static> Drop for PositiveImbalance<T, I>
impl<T: Config<I>, I: 'static> Drop for PositiveImbalance<T, I>
sourceimpl<T: Config<I>, I: 'static> Imbalance<<T as Config<I>>::Balance> for PositiveImbalance<T, I>
impl<T: Config<I>, I: 'static> Imbalance<<T as Config<I>>::Balance> for PositiveImbalance<T, I>
type Opposite = NegativeImbalance<T, I>
type Opposite = NegativeImbalance<T, I>
The oppositely imbalanced type. They come in pairs.
sourcefn drop_zero(self) -> Result<(), Self>
fn drop_zero(self) -> Result<(), Self>
Drop an instance cleanly. Only works if its self.value()
is zero.
sourcefn split(self, amount: T::Balance) -> (Self, Self)
fn split(self, amount: T::Balance) -> (Self, Self)
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
sourcefn merge(self, other: Self) -> Self
fn merge(self, other: Self) -> Self
Consume self
and an other
to return a new instance that combines
both. Read more
sourcefn subsume(&mut self, other: Self)
fn subsume(&mut self, other: Self)
Consume an other
to mutate self
into a new instance that combines
both. Read more
sourcefn offset(self, other: Self::Opposite) -> Result<Self, Self::Opposite>
fn offset(self, other: Self::Opposite) -> Result<Self, Self::Opposite>
Consume self and along with an opposite counterpart to return a combined result. Read more
sourcefn ration(self, first: u32, second: u32) -> (Self, Self) where
Balance: From<u32> + Saturating + Div<Balance, Output = Balance>,
fn ration(self, first: u32, second: u32) -> (Self, Self) where
Balance: From<u32> + Saturating + Div<Balance, Output = Balance>,
Consume self
and return two independent instances; the amounts returned will be in
approximately the same ratio as first
:second
. Read more
sourcefn split_merge(self, amount: Balance, others: (Self, Self)) -> (Self, Self)
fn split_merge(self, amount: Balance, others: (Self, Self)) -> (Self, Self)
Consume self and add its two components, defined by the first component’s balance, element-wise to two pre-existing Imbalances. Read more
sourcefn ration_merge(
self,
first: u32,
second: u32,
others: (Self, Self)
) -> (Self, Self) where
Balance: From<u32> + Saturating + Div<Balance, Output = Balance>,
fn ration_merge(
self,
first: u32,
second: u32,
others: (Self, Self)
) -> (Self, Self) where
Balance: From<u32> + Saturating + Div<Balance, Output = Balance>,
Consume self and add its two components, defined by the ratio first
:second
,
element-wise to two pre-existing Imbalances. Read more
sourcefn split_merge_into(self, amount: Balance, others: &mut (Self, Self))
fn split_merge_into(self, amount: Balance, others: &mut (Self, Self))
Consume self and add its two components, defined by the first component’s balance, element-wise into two pre-existing Imbalance refs. Read more
sourcefn ration_merge_into(self, first: u32, second: u32, others: &mut (Self, Self)) where
Balance: From<u32> + Saturating + Div<Balance, Output = Balance>,
fn ration_merge_into(self, first: u32, second: u32, others: &mut (Self, Self)) where
Balance: From<u32> + Saturating + Div<Balance, Output = Balance>,
Consume self and add its two components, defined by the ratio first
:second
,
element-wise to two pre-existing Imbalances. Read more
sourcefn merge_into(self, other: &mut Self)
fn merge_into(self, other: &mut Self)
Consume self to mutate other
so that it combines both. Just like subsume
, only with
reversed arguments. Read more
sourcefn maybe_merge(self, other: Option<Self>) -> Self
fn maybe_merge(self, other: Option<Self>) -> Self
Consume self
and maybe an other
to return a new instance that combines
both. Read more
sourcefn maybe_subsume(&mut self, other: Option<Self>)
fn maybe_subsume(&mut self, other: Option<Self>)
Maybe consume an other
to mutate self
into a new instance that combines
both. Read more
sourceimpl<T: PartialEq + Config<I>, I: PartialEq + 'static> PartialEq<PositiveImbalance<T, I>> for PositiveImbalance<T, I> where
T::Balance: PartialEq,
impl<T: PartialEq + Config<I>, I: PartialEq + 'static> PartialEq<PositiveImbalance<T, I>> for PositiveImbalance<T, I> where
T::Balance: PartialEq,
sourcefn eq(&self, other: &PositiveImbalance<T, I>) -> bool
fn eq(&self, other: &PositiveImbalance<T, I>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PositiveImbalance<T, I>) -> bool
fn ne(&self, other: &PositiveImbalance<T, I>) -> bool
This method tests for !=
.
sourceimpl<T: Config<I>, I: 'static> TryDrop for PositiveImbalance<T, I>
impl<T: Config<I>, I: 'static> TryDrop for PositiveImbalance<T, I>
impl<T: Eq + Config<I>, I: Eq + 'static> Eq for PositiveImbalance<T, I> where
T::Balance: Eq,
impl<T: Config<I>, I: 'static> StructuralEq for PositiveImbalance<T, I>
impl<T: Config<I>, I: 'static> StructuralPartialEq for PositiveImbalance<T, I>
Auto Trait Implementations
impl<T, I> RefUnwindSafe for PositiveImbalance<T, I> where
<T as Config<I>>::Balance: RefUnwindSafe,
impl<T, I> Send for PositiveImbalance<T, I>
impl<T, I> Sync for PositiveImbalance<T, I>
impl<T, I> Unpin for PositiveImbalance<T, I> where
<T as Config<I>>::Balance: Unpin,
impl<T, I> UnwindSafe for PositiveImbalance<T, I> where
<T as Config<I>>::Balance: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedConversion for T
impl<T> CheckedConversion for T
sourcefn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
sourcefn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
sourcefn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
sourcefn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcepub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
sourceimpl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
sourcepub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.