[][src]Struct sp_phragmen::Assignment

pub struct Assignment<AccountId, T: PerThing> {
    pub who: AccountId,
    pub distribution: Vec<(AccountId, T)>,
}

A voter's stake assignment among a set of targets, represented as ratios.

Fields

who: AccountId

Voter's identifier.

distribution: Vec<(AccountId, T)>

The distribution of the voter's stake.

Implementations

impl<AccountId, T: PerThing> Assignment<AccountId, T> where
    ExtendedBalance: From<<T as PerThing>::Inner>, 
[src]

pub fn into_staked(
    self,
    stake: ExtendedBalance,
    fill: bool
) -> StakedAssignment<AccountId> where
    T: Mul<ExtendedBalance, Output = ExtendedBalance>, 
[src]

Convert from a ratio assignment into one with absolute values aka. StakedAssignment.

It needs stake which is the total budget of the voter. 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 the total budget, by adding or subtracting the remainder from the last distribution.

If an edge ratio is Bounded::max_value(), it is dropped. This edge can never mean anything useful.

Trait Implementations

impl<AccountId: Clone, T: Clone + PerThing> Clone for Assignment<AccountId, T>[src]

impl<AccountId: Debug, T: Debug + PerThing> Debug for Assignment<AccountId, T>[src]

impl<AccountId, T: PerThing> Decode for Assignment<AccountId, T> where
    AccountId: Decode,
    AccountId: Decode,
    Vec<(AccountId, T)>: Decode,
    Vec<(AccountId, T)>: Decode
[src]

impl<AccountId: Default, T: Default + PerThing> Default for Assignment<AccountId, T>[src]

impl<AccountId, T: PerThing> Encode for Assignment<AccountId, T> where
    AccountId: Encode,
    AccountId: Encode,
    Vec<(AccountId, T)>: Encode,
    Vec<(AccountId, T)>: Encode
[src]

impl<AccountId, T: PerThing> EncodeLike<Assignment<AccountId, T>> for Assignment<AccountId, T> where
    AccountId: Encode,
    AccountId: Encode,
    Vec<(AccountId, T)>: Encode,
    Vec<(AccountId, T)>: Encode
[src]

impl<AccountId: Eq, T: Eq + PerThing> Eq for Assignment<AccountId, T>[src]

impl<AccountId: PartialEq, T: PartialEq + PerThing> PartialEq<Assignment<AccountId, T>> for Assignment<AccountId, T>[src]

impl<AccountId, T: PerThing> StructuralEq for Assignment<AccountId, T>[src]

impl<AccountId, T: PerThing> StructuralPartialEq for Assignment<AccountId, T>[src]

Auto Trait Implementations

impl<AccountId, T> RefUnwindSafe for Assignment<AccountId, T> where
    AccountId: RefUnwindSafe,
    T: RefUnwindSafe

impl<AccountId, T> Send for Assignment<AccountId, T> where
    AccountId: Send,
    T: Send

impl<AccountId, T> Sync for Assignment<AccountId, T> where
    AccountId: Sync,
    T: Sync

impl<AccountId, T> Unpin for Assignment<AccountId, T> where
    AccountId: Unpin,
    T: Unpin

impl<AccountId, T> UnwindSafe for Assignment<AccountId, T> where
    AccountId: UnwindSafe,
    T: 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]