ResultOf

Undocumented in source.

Members

Aliases

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

Functions

enforceOk
void enforceOk()
Undocumented in source. Be warned that the author may not have intended to support it.
error
string error()
Undocumented in source. Be warned that the author may not have intended to support it.
errorCode
int errorCode()
Undocumented in source. Be warned that the author may not have intended to support it.
isError
bool isError()
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.
opAssign
void opAssign(ResultOf!DataT notNullResult)
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, int errorCode)
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", 200);
auto init   = ResultOf!int.init;
auto void_  = Result.ok();

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

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

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

assert(void_.isOk);

Meta