assert(ok(42).expect("oops") == 42); ok().expect("oops"); // void value () @trusted { assert(collectExceptionMsg!Throwable(Expected!int.init.expect("oops")) == "oops: empty"); assert(collectExceptionMsg!Throwable(err!int("foo").expect("oops")) == "oops: foo"); }();
Unwraps a result, yielding the content of expected value. If there is none, or error value, it throws assert(0) with the provided message.