list_fn/option_list.rs
1use super::*;
2
3pub enum OptionList<I, E> {
4 Some { first: I, end: E },
5 End(E),
6}
7
8impl<I, E> ListFn for OptionList<I, E> {
9 type Item = I;
10 type End = E;
11 fn next(self) -> ListState<Self> {
12 match self {
13 OptionList::Some { first, end } => ListState::some(first, OptionList::End(end)),
14 OptionList::End(end) => ListState::End(end),
15 }
16 }
17}