unzipped property

  1. @useResult
(Option<T>, Option<U>) unzipped

An Option containing a tuple transformed into a tuple of two Options.

Examples

// prints "(Some(2), Some(true))"
print(const Some((2, true)).unzipped);

// prints "(None, None)"
print(const None<(int, bool)>().unzipped);

Implementation

@useResult
(Option<T>, Option<U>) get unzipped {
  return switch (this) {
    Some(:final value) => (Some(value.$1), Some(value.$2)),
    None() => (None<T>(), None<U>()),
  };
}