referrerpolicy=no-referrer-when-downgrade
frame_election_provider_support

Type Alias IndexAssignmentOf

Source
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>

Source

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>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<VoterIndex, TargetIndex, P> Debug for IndexAssignment<VoterIndex, TargetIndex, P>
where VoterIndex: Debug, TargetIndex: Debug, P: Debug + PerThing,

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<VoterIndex, TargetIndex, P: PerThing> Decode for IndexAssignment<VoterIndex, TargetIndex, P>
where VoterIndex: Decode, Vec<(TargetIndex, P)>: Decode,

Source§

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,

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,

Attempt to skip the encoded value from input. Read more
§

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>

Source§

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>
where VoterIndex: Encode, Vec<(TargetIndex, P)>: Encode,

Source§

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, )

Convert self to a slice and append it to the destination.
§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
§

fn using_encoded<R, F>(&self, f: F) -> R
where F: FnOnce(&[u8]) -> R,

Convert self to a slice and then invoke the given closure with it.
§

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>

Source§

fn eq(&self, other: &IndexAssignment<VoterIndex, TargetIndex, P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<VoterIndex, TargetIndex, P: PerThing> EncodeLike for IndexAssignment<VoterIndex, TargetIndex, P>
where VoterIndex: Encode, Vec<(TargetIndex, P)>: Encode,

Source§

impl<VoterIndex: Eq, TargetIndex: Eq, P: Eq + PerThing> Eq for IndexAssignment<VoterIndex, TargetIndex, P>

Source§

impl<VoterIndex, TargetIndex, P: PerThing> StructuralPartialEq for IndexAssignment<VoterIndex, TargetIndex, P>