Function enum_iterator::all
source · pub fn all<T: Sequence>() -> All<T> ⓘ
Expand description
Returns an iterator over all values of type T
.
Values are yielded in the order defined by Sequence::next
, starting with
Sequence::first
.
Example
use enum_iterator::{all, Sequence};
#[derive(Debug, PartialEq, Sequence)]
enum Color { Red, Green, Blue }
assert_eq!(
all::<Color>().collect::<Vec<_>>(),
[Color::Red, Color::Green, Color::Blue],
);