Option-like enums for working with ordered collections of zero, one, or two items (
Zot), or ordered collections of one or two items (
let zot = Zot::Two("one", "two"); assert_eq!(zot.last(), Some("two")); let ot = Ot::One("just one"); assert!(ot.is_one());
Most functionality mimics
Option with a few exceptions:
- Some new functions relating to the relative positions have been added:
firstgets the singular element from
*::Oneor the first element from
secondgets the second element from
lastgets the second element from
*::Twoor the singular element from
Zotonly) variations are also included.
- Some functions which don't have a clear analogue when working with 2 values are not included (e.g.
FnMutparameter instead of
FnOnceas the function may need to be called twice.