[−][src]Struct sp_phragmen::StakedAssignment
A voter's stake assignment among a set of targets, represented as absolute values in the scale
of ExtendedBalance
.
Fields
who: AccountId
Voter's identifier
distribution: Vec<(AccountId, ExtendedBalance)>
The distribution of the voter's stake.
Implementations
impl<AccountId> StakedAssignment<AccountId>
[src]
pub fn into_assignment<T: PerThing>(
self,
fill: bool
) -> Assignment<AccountId, T> where
ExtendedBalance: From<<T as PerThing>::Inner>,
[src]
self,
fill: bool
) -> Assignment<AccountId, T> where
ExtendedBalance: From<<T as PerThing>::Inner>,
Converts self into the normal Assignment
type.
If fill
is set to true, it tries to ensure that all the potential rounding errors are
compensated and the distribution's sum is exactly equal to 100%, by adding or subtracting
the remainder from the last distribution.
NOTE: it is quite critical that this attempt always works. The data type returned here will potentially get used to create a compact type; a compact type requires sum of ratios to be less than 100% upon un-compacting.
If an edge stake is so small that it cannot be represented in T
, it is ignored. This edge
can never be re-created and does not mean anything useful anymore.
pub fn total(&self) -> ExtendedBalance
[src]
Get the total stake of this assignment (aka voter budget).
Trait Implementations
impl<AccountId: Clone> Clone for StakedAssignment<AccountId>
[src]
fn clone(&self) -> StakedAssignment<AccountId>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<AccountId: Debug> Debug for StakedAssignment<AccountId>
[src]
impl<AccountId> Decode for StakedAssignment<AccountId> where
AccountId: Decode,
AccountId: Decode,
Vec<(AccountId, ExtendedBalance)>: Decode,
Vec<(AccountId, ExtendedBalance)>: Decode,
[src]
AccountId: Decode,
AccountId: Decode,
Vec<(AccountId, ExtendedBalance)>: Decode,
Vec<(AccountId, ExtendedBalance)>: Decode,
impl<AccountId: Default> Default for StakedAssignment<AccountId>
[src]
fn default() -> StakedAssignment<AccountId>
[src]
impl<AccountId> Encode for StakedAssignment<AccountId> where
AccountId: Encode,
AccountId: Encode,
Vec<(AccountId, ExtendedBalance)>: Encode,
Vec<(AccountId, ExtendedBalance)>: Encode,
[src]
AccountId: Encode,
AccountId: Encode,
Vec<(AccountId, ExtendedBalance)>: Encode,
Vec<(AccountId, ExtendedBalance)>: Encode,
fn encode_to<EncOut: Output>(&self, dest: &mut EncOut)
[src]
fn size_hint(&self) -> usize
[src]
fn encode(&self) -> Vec<u8>
[src]
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
[src]
F: FnOnce(&[u8]) -> R,
impl<AccountId> EncodeLike<StakedAssignment<AccountId>> for StakedAssignment<AccountId> where
AccountId: Encode,
AccountId: Encode,
Vec<(AccountId, ExtendedBalance)>: Encode,
Vec<(AccountId, ExtendedBalance)>: Encode,
[src]
AccountId: Encode,
AccountId: Encode,
Vec<(AccountId, ExtendedBalance)>: Encode,
Vec<(AccountId, ExtendedBalance)>: Encode,
impl<AccountId: Eq> Eq for StakedAssignment<AccountId>
[src]
impl<AccountId: PartialEq> PartialEq<StakedAssignment<AccountId>> for StakedAssignment<AccountId>
[src]
fn eq(&self, other: &StakedAssignment<AccountId>) -> bool
[src]
fn ne(&self, other: &StakedAssignment<AccountId>) -> bool
[src]
impl<AccountId> StructuralEq for StakedAssignment<AccountId>
[src]
impl<AccountId> StructuralPartialEq for StakedAssignment<AccountId>
[src]
Auto Trait Implementations
impl<AccountId> RefUnwindSafe for StakedAssignment<AccountId> where
AccountId: RefUnwindSafe,
AccountId: RefUnwindSafe,
impl<AccountId> Send for StakedAssignment<AccountId> where
AccountId: Send,
AccountId: Send,
impl<AccountId> Sync for StakedAssignment<AccountId> where
AccountId: Sync,
AccountId: Sync,
impl<AccountId> Unpin for StakedAssignment<AccountId> where
AccountId: Unpin,
AccountId: Unpin,
impl<AccountId> UnwindSafe for StakedAssignment<AccountId> where
AccountId: UnwindSafe,
AccountId: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<S> Codec for S where
S: Encode + Decode,
[src]
S: Encode + Decode,
impl<T, X> Decode for X where
T: Decode + Into<X>,
X: WrapperTypeDecode<Wrapped = T>,
[src]
T: Decode + Into<X>,
X: WrapperTypeDecode<Wrapped = T>,
impl<T> DecodeAll for T where
T: Decode,
[src]
T: Decode,
impl<T, X> Encode for X where
T: Encode + ?Sized,
X: WrapperTypeEncode<Target = T>,
[src]
T: Encode + ?Sized,
X: WrapperTypeEncode<Target = T>,
fn size_hint(&self) -> usize
[src]
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
[src]
F: FnOnce(&[u8]) -> R,
fn encode(&self) -> Vec<u8>
[src]
fn encode_to<W>(&self, dest: &mut W) where
W: Output,
[src]
W: Output,
impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
T: Encode,
[src]
T: Encode,
impl<'_, T> EncodeLike<&'_ T> for T where
T: Encode,
[src]
T: Encode,
impl<'_, T> EncodeLike<&'_ mut T> for T where
T: Encode,
[src]
T: Encode,
impl<T> EncodeLike<Arc<T>> for T where
T: Encode,
[src]
T: Encode,
impl<T> EncodeLike<Box<T>> for T where
T: Encode,
[src]
T: Encode,
impl<'a, T> EncodeLike<Cow<'a, T>> for T where
T: Encode + ToOwned,
[src]
T: Encode + ToOwned,
impl<T> EncodeLike<Rc<T>> for T where
T: Encode,
[src]
T: Encode,
impl<T> From<T> for T
[src]
impl<S> FullCodec for S where
S: Decode + FullEncode,
[src]
S: Decode + FullEncode,
impl<S> FullEncode for S where
S: Encode + EncodeLike<S>,
[src]
S: Encode + EncodeLike<S>,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> KeyedVec for T where
T: Codec,
[src]
T: Codec,
impl<T> SaturatedConversion for T
[src]
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
[src]
Self: UniqueSaturatedFrom<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
[src]
Self: UniqueSaturatedInto<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
S: TryInto<T>,
T: Bounded,
[src]
S: TryInto<T>,
T: Bounded,