where method
Filters this Option based on the given predicate function.
Returns None if this Option is None, otherwise calls predicate with
the held value, returning:
See also:
Rust: Option::filter()
Implementation
Option<T> where(bool Function(T) predicate) {
return switch (this) {
Some(:T v) => predicate(v) ? this : None(),
None() => this,
};
}