You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce ReceiveChannel.consumeAsFlow with efficient implementation
* This is a consuming conversion -- the resulting flow can be collected
just once and the channel is closed after the first collect.
* The implementation is made efficient (without iterators) using
a new internal ReceiveChannel.consumeEachTo function which also ensure
that the reference to the last emitted value is not retained.
* AbstractChannel implementation is optimized to avoid code duplication
in different receive methods.
Fixes#1340Fixes#1333
Copy file name to clipboardExpand all lines: binary-compatibility-validator/reference-public-api/kotlinx-coroutines-core.txt
+2
Original file line number
Diff line number
Diff line change
@@ -742,6 +742,7 @@ public abstract interface class kotlinx/coroutines/channels/ReceiveChannel {
742
742
public abstract synthetic fun cancel ()V
743
743
public abstract synthetic fun cancel (Ljava/lang/Throwable;)Z
744
744
public abstract fun cancel (Ljava/util/concurrent/CancellationException;)V
745
+
public abstract fun consumeEachTo (Lkotlinx/coroutines/flow/FlowCollector;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
745
746
public abstract fun getOnReceive ()Lkotlinx/coroutines/selects/SelectClause1;
746
747
public abstract fun getOnReceiveOrNull ()Lkotlinx/coroutines/selects/SelectClause1;
747
748
public abstract fun isClosedForReceive ()Z
@@ -827,6 +828,7 @@ public final class kotlinx/coroutines/flow/FlowKt {
827
828
public static final fun combineLatest (Lkotlinx/coroutines/flow/Flow;[Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
828
829
public static final synthetic fun combineLatest (Lkotlinx/coroutines/flow/Flow;[Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
829
830
public static final fun conflate (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
831
+
public static final fun consumeAsFlow (Lkotlinx/coroutines/channels/ReceiveChannel;)Lkotlinx/coroutines/flow/Flow;
830
832
public static final fun count (Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
831
833
public static final fun count (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
832
834
public static final fun debounce (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
0 commit comments