Module either

Source
Expand description

Extension of either::Either to provide support for NonEmptyIterator.

use nonempty_collections::*;
fn get_data(input: usize) -> NEEither<[usize; 1], [usize; 3]> {
    if input == 0 {
        NEEither::Left([0])
    } else {
        NEEither::Right([2, 1, 4])
    }
}

assert_eq!(
    nev![0],
    get_data(0).into_nonempty_iter().collect::<NEVec<_>>()
);

Enumsยง

NEEither
Non-empty variant of either::Either that implements NonEmptyIterator.