The actual map function.
A new Expected object containing the result.
{
assert(ok(42).map!(a => a/2).value == 21);
assert(ok().map!(() => 42).value == 42);
assert(err!int("foo").map!(a => 42).error == "foo");
assert(err("foo").map!(() => 42).error == "foo");
}
// remap hook
{
static struct Hook {}
auto res = ok(42).map!(a => a/2, Hook);
assert(res == 21);
static assert(is(typeof(res) == Expected!(int, string, Hook)));
}
Applies a function to the expected value in an Expected object.
If no expected value is present, the original error value is passed through unchanged, and the function is not called.