andThen

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

Examples

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

Meta