pub struct Assignment<AccountId, T: PerThing> {
pub who: AccountId,
pub distribution: Vec<(AccountId, T)>,
}Expand description
A voter’s stake assignment among a set of targets, represented as ratios.
Fields§
§who: AccountIdVoter’s identifier.
distribution: Vec<(AccountId, T)>The distribution of the voter’s stake.
Implementations§
Source§impl<AccountId, T: PerThing> Assignment<AccountId, T>
impl<AccountId, T: PerThing> Assignment<AccountId, T>
Sourcepub fn into_staked(
self,
stake: ExtendedBalance,
fill: bool,
) -> StakedAssignment<AccountId>
pub fn into_staked( self, stake: ExtendedBalance, fill: bool, ) -> StakedAssignment<AccountId>
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§
Source§impl<AccountId: Clone, T: Clone + PerThing> Clone for Assignment<AccountId, T>
impl<AccountId: Clone, T: Clone + PerThing> Clone for Assignment<AccountId, T>
Source§fn clone(&self) -> Assignment<AccountId, T>
fn clone(&self) -> Assignment<AccountId, T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<AccountId, T: PerThing> Decode for Assignment<AccountId, T>
impl<AccountId, T: PerThing> Decode for Assignment<AccountId, T>
Source§impl<AccountId: Default, T: Default + PerThing> Default for Assignment<AccountId, T>
impl<AccountId: Default, T: Default + PerThing> Default for Assignment<AccountId, T>
Source§fn default() -> Assignment<AccountId, T>
fn default() -> Assignment<AccountId, T>
Returns the “default value” for a type. Read more
Source§impl<AccountId, T: PerThing> Encode for Assignment<AccountId, T>
impl<AccountId, T: PerThing> Encode for Assignment<AccountId, T>
Source§fn encode_to<__CodecOutputEdqy: Output>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
impl<AccountId, T: PerThing> EncodeLike for Assignment<AccountId, T>
impl<AccountId: Eq, T: Eq + PerThing> Eq for Assignment<AccountId, T>
impl<AccountId, T: PerThing> StructuralPartialEq for Assignment<AccountId, T>
Auto Trait Implementations§
impl<AccountId, T> Freeze for Assignment<AccountId, T>where
AccountId: Freeze,
impl<AccountId, T> RefUnwindSafe for Assignment<AccountId, T>where
AccountId: RefUnwindSafe,
T: RefUnwindSafe,
impl<AccountId, T> Send for Assignment<AccountId, T>
impl<AccountId, T> Sync for Assignment<AccountId, T>
impl<AccountId, T> Unpin for Assignment<AccountId, T>
impl<AccountId, T> UnwindSafe for Assignment<AccountId, T>where
AccountId: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
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<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T.