flatMap

Forwards the expected value in an Expected object to a function that returns an Expected result.

If the original Expected object contains an error value, it is passed through to the result, and the function is not called.

template flatMap(alias fun)
flatMap
(
T
E1
)
(
Expected!(T, E1) self
)
if (
is(typeof(fun(self.value)) == Expected!(U, E2),
U
E2
) &&
is(E1 : E2)
)

Members

Functions

flatMap
auto flatMap(Expected!(T, E1) self)

The actual flatMap function.

Return Value

The Expected object returned from the function, or an Expected object of the same type containing the original error value.

Meta