handle

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

Examples

assert(Result!int.ok(3).handle!((ref n) => n += 7) == 10.ok);
assert(Result!int.ok(3).handle!((ref n) => n + 7) == 3.ok);
assert(Result!int.err("failure").handle!((ref n) => n = 0) == "failure".err);

Meta