• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 package kotlinx.coroutines.flow
6 
7 /**
8  * [FlowCollector] is used as an intermediate or a terminal collector of the flow and represents
9  * an entity that accepts values emitted by the [Flow].
10  *
11  * This interface should usually not be implemented directly, but rather used as a receiver in a [flow] builder when implementing a custom operator.
12  * Implementations of this interface are not thread-safe.
13  */
14 public interface FlowCollector<in T> {
15 
16     /**
17      * Collects the value emitted by the upstream.
18      * This method is not thread-safe and should not be invoked concurrently.
19      */
emitnull20     public suspend fun emit(value: T)
21 }
22