// source: https://doc.rust-lang.org/std/result/enum.Result.html#method.or_else alias R = Result!(int, int); auto sqr = delegate R(int x) => (x * x).ok; auto keep = delegate R(int x) => x.err; assert(R.ok(2).orElse!sqr.orElse!sqr == 2.ok); assert(R.ok(2).orElse!keep.orElse!sqr == 2.ok); assert(R.err(3).orElse!sqr.orElse!keep == 9.ok); assert(R.err(3).orElse!keep.orElse!keep == 3.err);