Struct sp_staking::currency_to_vote::U128CurrencyToVote
source · pub struct U128CurrencyToVote;
Expand description
An implementation of CurrencyToVote
tailored for chain’s that have a balance type of u128.
The factor is the (total_issuance / u64::MAX).max(1)
, represented as u64. Let’s look at the
important cases:
If the chain’s total issuance is less than u64::MAX, this will always be 1, which means that
the factor will not have any effect. In this case, any account’s balance is also less. Thus,
both of the conversions are basically an as
; Any balance can fit in u64.
If the chain’s total issuance is more than 2*u64::MAX, then a factor might be multiplied and divided upon conversion.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for U128CurrencyToVote
impl Send for U128CurrencyToVote
impl Sync for U128CurrencyToVote
impl Unpin for U128CurrencyToVote
impl UnwindSafe for U128CurrencyToVote
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
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
.