Trait frame::traits::Polling

pub trait Polling<Tally> {
    type Index: Parameter + Member + Ord + PartialOrd<Self::Index> + Copy + HasCompact + MaxEncodedLen;
    type Votes: Parameter + Member + Ord + PartialOrd<Self::Votes> + Copy + HasCompact + MaxEncodedLen;
    type Class: Parameter + Member + Ord + PartialOrd<Self::Class> + MaxEncodedLen;
    type Moment;

    // Required methods
    fn classes() -> Vec<Self::Class, Global>;
    fn as_ongoing(index: Self::Index) -> Option<(Tally, Self::Class)>;
    fn access_poll<R>(
        index: Self::Index,
        f: impl FnOnce(PollStatus<&mut Tally, Self::Moment, Self::Class>) -> R
    ) -> R;
    fn try_access_poll<R>(
        index: Self::Index,
        f: impl FnOnce(PollStatus<&mut Tally, Self::Moment, Self::Class>) -> Result<R, DispatchError>
    ) -> Result<R, DispatchError>;
}

Required Associated Types§

type Index: Parameter + Member + Ord + PartialOrd<Self::Index> + Copy + HasCompact + MaxEncodedLen

type Votes: Parameter + Member + Ord + PartialOrd<Self::Votes> + Copy + HasCompact + MaxEncodedLen

type Class: Parameter + Member + Ord + PartialOrd<Self::Class> + MaxEncodedLen

type Moment

Required Methods§

fn classes() -> Vec<Self::Class, Global>

Provides a vec of values that T may take.

fn as_ongoing(index: Self::Index) -> Option<(Tally, Self::Class)>

Some if the referendum index can be voted on, along with the tally and class of referendum.

Don’t use this if you might mutate - use try_access_poll instead.

fn access_poll<R>( index: Self::Index, f: impl FnOnce(PollStatus<&mut Tally, Self::Moment, Self::Class>) -> R ) -> R

fn try_access_poll<R>( index: Self::Index, f: impl FnOnce(PollStatus<&mut Tally, Self::Moment, Self::Class>) -> Result<R, DispatchError> ) -> Result<R, DispatchError>

Implementors§