pub type IndexAssignmentOf<C> = IndexAssignment<<C as NposSolution>::VoterIndex, <C as NposSolution>::TargetIndex, <C as NposSolution>::Accuracy>;
Expand description
A type alias for IndexAssignment
made from NposSolution
.
Aliased Type§
struct IndexAssignmentOf<C> {
pub who: <C as NposSolution>::VoterIndex,
pub distribution: Vec<(<C as NposSolution>::TargetIndex, <C as NposSolution>::Accuracy)>,
}
Fields§
§who: <C as NposSolution>::VoterIndex
Index of the voter among the voters list.
distribution: Vec<(<C as NposSolution>::TargetIndex, <C as NposSolution>::Accuracy)>
The distribution of the voter’s stake among winning targets.
Targets are identified by their index in the canonical list.
Implementations
Source§impl<VoterIndex: Debug, TargetIndex: Debug, P: PerThing> IndexAssignment<VoterIndex, TargetIndex, P>
impl<VoterIndex: Debug, TargetIndex: Debug, P: PerThing> IndexAssignment<VoterIndex, TargetIndex, P>
pub fn new<AccountId: IdentifierT>( assignment: &Assignment<AccountId, P>, voter_index: impl Fn(&AccountId) -> Option<VoterIndex>, target_index: impl Fn(&AccountId) -> Option<TargetIndex>, ) -> Result<Self, Error>
Trait Implementations
Source§impl<VoterIndex: Clone, TargetIndex: Clone, P: Clone + PerThing> Clone for IndexAssignment<VoterIndex, TargetIndex, P>
impl<VoterIndex: Clone, TargetIndex: Clone, P: Clone + PerThing> Clone for IndexAssignment<VoterIndex, TargetIndex, P>
Source§fn clone(&self) -> IndexAssignment<VoterIndex, TargetIndex, P>
fn clone(&self) -> IndexAssignment<VoterIndex, TargetIndex, P>
Returns a copy 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<VoterIndex, TargetIndex, P> Debug for IndexAssignment<VoterIndex, TargetIndex, P>
impl<VoterIndex, TargetIndex, P> Debug for IndexAssignment<VoterIndex, TargetIndex, P>
Source§impl<VoterIndex, TargetIndex, P: PerThing> Decode for IndexAssignment<VoterIndex, TargetIndex, P>
impl<VoterIndex, TargetIndex, P: PerThing> Decode for IndexAssignment<VoterIndex, TargetIndex, P>
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
Source§impl<VoterIndex: Default, TargetIndex: Default, P: Default + PerThing> Default for IndexAssignment<VoterIndex, TargetIndex, P>
impl<VoterIndex: Default, TargetIndex: Default, P: Default + PerThing> Default for IndexAssignment<VoterIndex, TargetIndex, P>
Source§fn default() -> IndexAssignment<VoterIndex, TargetIndex, P>
fn default() -> IndexAssignment<VoterIndex, TargetIndex, P>
Returns the “default value” for a type. Read more
Source§impl<VoterIndex, TargetIndex, P: PerThing> Encode for IndexAssignment<VoterIndex, TargetIndex, P>
impl<VoterIndex, TargetIndex, P: PerThing> Encode for IndexAssignment<VoterIndex, TargetIndex, P>
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 encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
§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.
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl<VoterIndex: PartialEq, TargetIndex: PartialEq, P: PartialEq + PerThing> PartialEq for IndexAssignment<VoterIndex, TargetIndex, P>
impl<VoterIndex: PartialEq, TargetIndex: PartialEq, P: PartialEq + PerThing> PartialEq for IndexAssignment<VoterIndex, TargetIndex, P>
Source§fn eq(&self, other: &IndexAssignment<VoterIndex, TargetIndex, P>) -> bool
fn eq(&self, other: &IndexAssignment<VoterIndex, TargetIndex, P>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.