collapse
fun <Ancestor : Any, Ok : Ancestor, Error : Ancestor> OutcomeFlow<Ok, Error>.collapse(): Flow<Ancestor>
inline fun <Ok : Any, Error : Any, Output> OutcomeFlow<Ok, Error>.collapse(crossinline success: suspend (Ok) -> Output, crossinline failure: suspend (Error) -> Output): Flow<Output>
Collapse the receiver Outcome into either value or error, using the nearest common Ancestor as the type.
Use Outcome.fold with success
and failure
lambda arguments to directly map each state to a specific Output
type instead.
Receiver
The Outcome to collapse.
Return
The collapsed value of the nearest common Ancestor type.
Parameters
Ok
The type of the Outcome.Success value.
Error
The type of the Outcome.Failure error.