mapToFinished

inline fun <In : Any, Out : Any> Fetch<In>.mapToFinished(initial: () -> Out, fetching: () -> Out, finished: (result: In) -> Out): Fetch.Finished<Out>

Transform all Fetch states into a finished state.

Unlike fold, mapToFinished re-wraps the results of each lambda as a finished state of type Out.

Receiver

The Fetch to transform.

Return

The transformed Fetch of type Out.

Parameters

In

The type of the Fetch value.

Out

The type of the transformed values.

initial

The lambda to transform the initial state into a finished.

fetching

The lambda to transform the fetching state into a finished.

finished

The lambda to transform the finished state into a finished.