handle

Undocumented in source. Be warned that the author may not have intended to support it.
ref
handle
(
alias pred
T
)
(
return auto ref scope Optional!T optional
)

Examples

assert(Optional!int.some(3).handle!((ref n) => n += 7) == 10.some);
assert(Optional!int.some(3).handle!((ref n) => n + 7) == 3.some);
assert(Optional!int.none.handle!((ref n) => n = 0) == .none);

Meta