[][src]Trait riven::consts::IntoEnumIterator

pub trait IntoEnumIterator {
    type Iterator: Iterator;
    pub fn iter() -> Self::Iterator;
}

Trait allowing iteration of enum types, implemented by several enums in this module. Re-exported from strum.

This trait designates that an Enum can be iterated over. It can be auto generated using strum_macros on your behalf.

Example

// You need to bring the type into scope to use it!!!
use strum::{EnumIter, IntoEnumIterator};

#[derive(EnumIter, Debug)]
enum Color {
    Red,
    Green { range: usize },
    Blue(usize),
    Yellow,
}

// Iterate over the items in an enum and perform some function on them.
fn generic_iterator<E, F>(pred: F)
where
    E: IntoEnumIterator,
    F: Fn(E),
{
    for e in E::iter() {
        pred(e)
    }
}

generic_iterator::<Color, _>(|color| println!("{:?}", color));

Associated Types

Loading content...

Required methods

pub fn iter() -> Self::Iterator[src]

Loading content...

Implementors

impl IntoEnumIterator for Champion[src]

type Iterator = ChampionIter

impl IntoEnumIterator for Division[src]

Returns a DoubleEndedIterator of I, II, III, IV. Ordered from high rank (I) to low (IV). Excludes V, which is deprecated.

type Iterator = Copied<Iter<'static, Self>>

impl IntoEnumIterator for Tier[src]

Returns a DoubleEndedIterator of I, II, III, IV. Ordered from high rank (I) to low (IV). Excludes V, which is deprecated.

type Iterator = Copied<Iter<'static, Self>>

Loading content...