fold

inline fun <Data : Any, Output> Fetch<Data>.fold(prefetch: Prefetch.() -> Output, fetching: Fetching<Data>.() -> Output, finished: Finished<Data>.() -> Output): Output

Transform all Fetch status into the Output type.

Fold can be used to map or flatMap all Fetch variants, but it also can output any type.

Receiver

The Fetch to fold.

Return

The folded value, of type Output.

Parameters

Data

The type of the Fetch value.

Output

The type of the folded value.

prefetch

The lambda to transform the Prefetch status.

fetching

The lambda to transform the Fetching status.

finished

The lambda to transform the Finished status.