ResultOf

Undocumented in source.

Members

Aliases

This
alias This = typeof(this)
Undocumented in source.

Functions

error
string error()
Undocumented in source. Be warned that the author may not have intended to support it.
isOk
bool isOk()
Undocumented in source. Be warned that the author may not have intended to support it.
value
inout(T) value()
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

IsVoid
enum IsVoid;
Undocumented in source.

Static functions

fail
This fail(string error)
Undocumented in source. Be warned that the author may not have intended to support it.
ok
This ok()
Undocumented in source. Be warned that the author may not have intended to support it.
ok
This ok(T value)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

auto ok     = ResultOf!int.ok(1);
auto fail   = ResultOf!int.fail("Bad");
auto init   = ResultOf!int.init;
auto void_  = Result.ok();

assert(ok.isOk);
assert(ok.value == 1);

assert(!fail.isOk);
assert(fail.error == "Bad");

assert(!init.isOk);
assert(init.error);

assert(void_.isOk);

Meta