Next Generation WASM Microkernel Operating System
1// Copyright 2025 Jonas Kruckenberg
2//
3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7
8pub enum Either<L, R> {
9 /// A value of type `L`.
10 Left(L),
11 /// A value of type `R`.
12 Right(R),
13}
14
15impl<L, R, T> Iterator for Either<L, R>
16where
17 L: Iterator<Item = T>,
18 R: Iterator<Item = T>,
19{
20 type Item = T;
21
22 fn next(&mut self) -> Option<Self::Item> {
23 match self {
24 Either::Left(left) => left.next(),
25 Either::Right(right) => right.next(),
26 }
27 }
28}