pub fn next_cycle<T: Sequence>(x: &T) -> Option<T>
Expand description
Returns the next value of type T
or first()
if this was the end.
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));