@@ -16,21 +16,14 @@ sealed interface EitherLCE<out L, out R> {
1616
1717fun <L , R > eitherLceFlow (function : suspend () -> Either <L , R >): Flow <EitherLCE <L , R >> =
1818 flowFromSuspend(function)
19- .map<Either < L , R > , EitherLCE <L , R >> { EitherLCE .ContentOrError (it) }
19+ .map<_ , EitherLCE <L , R >> { EitherLCE .ContentOrError (it) }
2020 .onStart { emit(EitherLCE .Loading ) }
2121
2222sealed class LCE <out T > {
2323 data object Loading : LCE <Nothing >()
2424 data class Content <out T >(val content : T ) : LCE<T>()
2525 data class Error (val error : Throwable ) : LCE<Nothing>()
2626
27- @Suppress(" NOTHING_TO_INLINE" )
28- companion object Factory {
29- inline fun <T > content (content : T ): LCE <T > = Content (content)
30- inline fun <T > loading (): LCE <T > = Loading
31- inline fun <T > error (error : Throwable ): LCE <T > = Error (error)
32- }
33-
3427 inline fun <R > map (f : (T ) -> R ): LCE <R > = when (this ) {
3528 is Content -> Content (f(content))
3629 is Error -> Error (error)
@@ -44,7 +37,14 @@ sealed class LCE<out T> {
4437 Loading -> Loading
4538 }
4639
47- inline val isLoading: Boolean get() = this == = Loading
40+ inline val isLoading: Boolean get() = this == Loading
4841
4942 inline val contentOrNull: T ? get() = (this as ? Content )?.content
43+
44+ @Suppress(" NOTHING_TO_INLINE" )
45+ companion object Factory {
46+ inline fun <T > content (content : T ): LCE <T > = Content (content)
47+ inline fun <T > loading (): LCE <T > = Loading
48+ inline fun <T > error (error : Throwable ): LCE <T > = Error (error)
49+ }
5050}
0 commit comments