asResult

fun <T> Flow<T>.asResult(): Flow<Result<T>>

Maps upstream emissions to Result.Success, emits Result.Loading on start, and Result.Error when the upstream fails.

CancellationException is rethrown so structured concurrency is preserved.