Function enum_iterator::next_cycle

source ·
pub fn next_cycle<T: Sequence>(x: &T) -> Option<T>
Expand description

Returns the next value of type T or T::first() if this was the end.

§Example

use enum_iterator::{next_cycle, Sequence};

#[derive(Debug, PartialEq, Sequence)]
enum Day { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }

assert_eq!(next_cycle(&Day::Sunday), Some(Day::Monday));