Struct tp_npos_elections::Voter[][src]

pub struct Voter<AccountId> { /* fields omitted */ }

A voter entity.

Implementations

impl<AccountId: IdentifierT> Voter<AccountId>[src]

pub fn into_assignment<P: PerThing>(self) -> Option<Assignment<AccountId, P>>[src]

Returns none if this voter does not have any non-zero distributions.

Note that this might create un-normalized assignments, due to accuracy loss of P. Call site might compensate by calling normalize() on the returned Assignment as a post-precessing.

pub fn try_normalize(&mut self) -> Result<(), &'static str>[src]

Try and normalize the votes of self.

If the normalization is successful then Ok(()) is returned.

Note that this will not distinguish between elected and unelected edges. Thus, it should only be called on a voter who has already been reduced to only elected edges.

Errors

This will return only if the internal normalize fails. This can happen if the sum of the weights exceeds ExtendedBalance::max_value().

pub fn try_normalize_elected(&mut self) -> Result<(), &'static str>[src]

Same as Self::try_normalize but the normalization is only limited between elected edges.

Trait Implementations

impl<AccountId: Clone> Clone for Voter<AccountId>[src]

impl<A: IdentifierT> Debug for Voter<A>[src]

impl<AccountId: Default> Default for Voter<AccountId>[src]

Auto Trait Implementations

impl<AccountId> !RefUnwindSafe for Voter<AccountId>

impl<AccountId> !Send for Voter<AccountId>

impl<AccountId> !Sync for Voter<AccountId>

impl<AccountId> Unpin for Voter<AccountId> where
    AccountId: Unpin

impl<AccountId> !UnwindSafe for Voter<AccountId>

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<T> Downcast for T where
    T: Any

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> MaybeDebug for T where
    T: Debug

impl<T> Same<T> for T

type Output = T

Should always be Self

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<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,