Function enum_iterator::next_cycle

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

Returns the next value of type T or 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), Day::Monday);