xor method
Returns Some if exactly one of this Option
and other
is Some, otherwise
returns None.
Returns:
- This
Option
if thisOption
is Some andother
is None. other
if thisOption
is None andother
is Some.- None otherwise.
See also:
Rust: Option::xor()
Implementation
Option<T> xor(Option<T> other) => switch ((this, other)) {
(Some(), None()) => this,
(None(), Some()) => other,
_ => None()
};