andThen

Undocumented in source. Be warned that the author may not have intended to support it.
  1. auto andThen(Result!(T, E) result)
  2. auto andThen(Result!(T, E) result)
  3. auto andThen(Result!(T, E) result)
    andThen
    (
    alias pred
    T
    E
    )
    (
    auto ref scope Result!(T, E) result
    )
    if (
    is(typeof(pred(T.init)) == Err!E)
    )
  4. auto andThen(Result!(T, E) result)

Examples

alias R = Result!int;
assert(R.err("failure").andThen!(i => ok(i + 3)) == "failure".err);
assert(R.ok(7).andThen!(i => err("failure")) == "failure".err);

Meta