[−][src]Struct sp_phragmen::Assignment
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]
ExtendedBalance: From<<T as PerThing>::Inner>,
pub fn into_staked(
self,
stake: ExtendedBalance,
fill: bool
) -> StakedAssignment<AccountId> where
T: Mul<ExtendedBalance, Output = ExtendedBalance>,
[src]
self,
stake: ExtendedBalance,
fill: bool
) -> StakedAssignment<AccountId> where
T: Mul<ExtendedBalance, Output = ExtendedBalance>,
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]
fn clone(&self) -> Assignment<AccountId, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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]
AccountId: Decode,
AccountId: Decode,
Vec<(AccountId, T)>: Decode,
Vec<(AccountId, T)>: Decode,
impl<AccountId: Default, T: Default + PerThing> Default for Assignment<AccountId, T>
[src]
fn default() -> 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]
AccountId: Encode,
AccountId: Encode,
Vec<(AccountId, T)>: Encode,
Vec<(AccountId, T)>: 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, T: PerThing> EncodeLike<Assignment<AccountId, T>> for Assignment<AccountId, T> where
AccountId: Encode,
AccountId: Encode,
Vec<(AccountId, T)>: Encode,
Vec<(AccountId, T)>: Encode,
[src]
AccountId: Encode,
AccountId: Encode,
Vec<(AccountId, T)>: Encode,
Vec<(AccountId, T)>: Encode,
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]
fn eq(&self, other: &Assignment<AccountId, T>) -> bool
[src]
fn ne(&self, other: &Assignment<AccountId, T>) -> bool
[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,
AccountId: RefUnwindSafe,
T: RefUnwindSafe,
impl<AccountId, T> Send for Assignment<AccountId, T> where
AccountId: Send,
T: Send,
AccountId: Send,
T: Send,
impl<AccountId, T> Sync for Assignment<AccountId, T> where
AccountId: Sync,
T: Sync,
AccountId: Sync,
T: Sync,
impl<AccountId, T> Unpin for Assignment<AccountId, T> where
AccountId: Unpin,
T: Unpin,
AccountId: Unpin,
T: Unpin,
impl<AccountId, T> UnwindSafe for Assignment<AccountId, T> where
AccountId: UnwindSafe,
T: UnwindSafe,
AccountId: UnwindSafe,
T: 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,