[][src]Struct sp_phragmen::StakedAssignment

pub struct StakedAssignment<AccountId> {
    pub who: AccountId,
    pub distribution: Vec<(AccountId, ExtendedBalance)>,
}

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]

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]

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]

impl<AccountId: Default> Default for StakedAssignment<AccountId>[src]

impl<AccountId> Encode for StakedAssignment<AccountId> where
    AccountId: Encode,
    AccountId: Encode,
    Vec<(AccountId, ExtendedBalance)>: Encode,
    Vec<(AccountId, ExtendedBalance)>: Encode
[src]

impl<AccountId> EncodeLike<StakedAssignment<AccountId>> for StakedAssignment<AccountId> where
    AccountId: Encode,
    AccountId: Encode,
    Vec<(AccountId, ExtendedBalance)>: Encode,
    Vec<(AccountId, ExtendedBalance)>: Encode
[src]

impl<AccountId: Eq> Eq for StakedAssignment<AccountId>[src]

impl<AccountId: PartialEq> PartialEq<StakedAssignment<AccountId>> for StakedAssignment<AccountId>[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

impl<AccountId> Send for StakedAssignment<AccountId> where
    AccountId: Send

impl<AccountId> Sync for StakedAssignment<AccountId> where
    AccountId: Sync

impl<AccountId> Unpin for StakedAssignment<AccountId> where
    AccountId: Unpin

impl<AccountId> UnwindSafe for StakedAssignment<AccountId> where
    AccountId: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<S> Codec for S where
    S: Encode + Decode
[src]

impl<T, X> Decode for X where
    T: Decode + Into<X>,
    X: WrapperTypeDecode<Wrapped = T>, 
[src]

impl<T> DecodeAll for T where
    T: Decode
[src]

impl<T, X> Encode for X where
    T: Encode + ?Sized,
    X: WrapperTypeEncode<Target = T>, 
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T>> for T where
    T: Encode
[src]

impl<'a, T> EncodeLike<Cow<'a, T>> for T where
    T: Encode + ToOwned
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<S> FullCodec for S where
    S: Decode + FullEncode
[src]

impl<S> FullEncode for S where
    S: Encode + EncodeLike<S>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> KeyedVec for T where
    T: Codec
[src]

impl<T> SaturatedConversion for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded
[src]