@@ -12,12 +12,12 @@ import reactor.util.context.*
12
12
/* *
13
13
* Wraps Reactor's [Context] into a [CoroutineContext] element for seamless integration between
14
14
* Reactor and kotlinx.coroutines.
15
- * [Context.asCoroutineContext] is defined to place Reactor's [Context] elements into a [CoroutineContext],
15
+ * [Context.asCoroutineContext] puts Reactor's [Context] elements into a [CoroutineContext],
16
16
* which can be used to propagate the information about Reactor's [Context] through coroutines.
17
17
*
18
- * This context element is implicitly propagated through subscriber's context by all Reactive integrations,
18
+ * This context element is implicitly propagated through subscribers' context by all Reactive integrations,
19
19
* such as [mono], [flux], [Publisher.asFlow][asFlow], [Flow.asPublisher][asPublisher] and [Flow.asFlux][asFlux].
20
- * Functions that subscribe to the reactive stream
20
+ * Functions that subscribe to a reactive stream
21
21
* (e.g. [Publisher.awaitFirst][kotlinx.coroutines.reactive.awaitFirst]), too, propagate [ReactorContext]
22
22
* to the subscriber's [Context].
23
23
**
@@ -52,6 +52,7 @@ import reactor.util.context.*
52
52
@ExperimentalCoroutinesApi
53
53
public class ReactorContext (public val context : Context ) : AbstractCoroutineContextElement(ReactorContext ) {
54
54
55
+ // `Context.of` is zero-cost if the argument is a `Context`
55
56
public constructor (contextView: ContextView ): this (Context .of(contextView))
56
57
57
58
public companion object Key : CoroutineContext.Key<ReactorContext>
@@ -69,8 +70,8 @@ public fun ContextView.asCoroutineContext(): ReactorContext = ReactorContext(thi
69
70
* and later used via `coroutineContext[ReactorContext]`.
70
71
*/
71
72
@ExperimentalCoroutinesApi
72
- @Deprecated(" Use the more general version for ContextView instead" , level = DeprecationLevel .HIDDEN )
73
- public fun Context.asCoroutineContext (): ReactorContext = readOnly().asCoroutineContext()
73
+ @Deprecated(" The more general version for ContextView should be used instead" , level = DeprecationLevel .HIDDEN )
74
+ public fun Context.asCoroutineContext (): ReactorContext = readOnly().asCoroutineContext() // `readOnly()` is zero-cost.
74
75
75
76
/* *
76
77
* Updates the Reactor context in this [CoroutineContext], adding (or possibly replacing) some values.
0 commit comments