Abort

Default hook implementation for Expected

Members

Static functions

onAccessEmptyError
void onAccessEmptyError()

Handler for case when empty error is accessed.

onAccessEmptyValue
void onAccessEmptyValue(E err)

Handler for case when empty value is accessed.

Static variables

enableDefaultConstructor
bool enableDefaultConstructor;

Default constructor for Expected is disabled. Same with the opAssign, so Expected can be only constructed once and not modified afterwards.

Examples

1 static assert(!isDefaultConstructorEnabled!Abort);
2 static assert(hasOnAccessEmptyValue!(Abort, string));
3 static assert(hasOnAccessEmptyValue!(Abort, int));
4 static assert(hasOnAccessEmptyError!Abort);
5 
6 version (D_Exceptions)
7 {
8     assertThrown!Throwable(ok(42).error);
9     assertThrown!Throwable(err!int("foo").value);
10 }

Meta