isSomeAnd method
Returns whether or not this Option holds a value (Some) and the held
value matches the given predicate.
Returns:
trueif thisOptionis Some andpredicatereturnstrue.falseif thisOptionis None, orpredicatereturnsfalse
See also:
Rust: Option::is_some_and()
Implementation
bool isSomeAnd(bool Function(T) predicate) {
return switch (this) {
Some(:T v) => predicate(v),
None() => false,
};
}