Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0317b57c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[kairos] Fix KDoc code snippet rendering" into main

parents abdf6392 487d6764
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ interface BuildScope : HasNetwork, StateScope {
     * observation of new emissions. It will however *not* cancel any running effects from previous
     * emissions. To achieve this behavior, use [launchScope] or [asyncScope] to create a child
     * build scope:
     * ``` kotlin
     * ```
     *   val job = launchScope {
     *       events.observe { x ->
     *           launchEffect { longRunningEffect(x) }
@@ -141,7 +141,7 @@ interface BuildScope : HasNetwork, StateScope {
     *
     * By default, [builder] is only running while the returned [Events] is being
     * [observed][observe]. If you want it to run at all times, simply add a no-op observer:
     * ``` kotlin
     * ```
     *   events { ... }.apply { observe() }
     * ```
     */
@@ -158,7 +158,7 @@ interface BuildScope : HasNetwork, StateScope {
     *
     * By default, [builder] is only running while the returned [Events] is being
     * [observed][observe]. If you want it to run at all times, simply add a no-op observer:
     * ``` kotlin
     * ```
     *   events { ... }.apply { observe() }
     * ```
     *
@@ -196,7 +196,7 @@ interface BuildScope : HasNetwork, StateScope {
     * outside of the current Kairos transaction; when [transform] returns, the returned value is
     * emitted from the result [Events] in a new transaction.
     *
     * ``` kotlin
     * ```
     *     fun <A, B> Events<A>.mapAsyncLatest(transform: suspend (A) -> B): Events<B> =
     *         mapLatestBuild { a -> asyncEvent { transform(a) } }.flatten()
     * ```
@@ -571,7 +571,7 @@ interface BuildScope : HasNetwork, StateScope {

    /**
     * Shorthand for:
     * ``` kotlin
     * ```
     * flow.toEvents().holdState(initialValue)
     * ```
     */
@@ -579,7 +579,7 @@ interface BuildScope : HasNetwork, StateScope {

    /**
     * Shorthand for:
     * ``` kotlin
     * ```
     * flow.scan(initialValue, operation).toEvents().holdState(initialValue)
     * ```
     */
@@ -588,7 +588,7 @@ interface BuildScope : HasNetwork, StateScope {

    /**
     * Shorthand for:
     * ``` kotlin
     * ```
     * flow.scan(initialValue) { a, f -> f(a) }.toEvents().holdState(initialValue)
     * ```
     */
@@ -665,7 +665,7 @@ interface BuildScope : HasNetwork, StateScope {
     * be used to make further modifications to the Kairos network, and/or perform side-effects via
     * [effect].
     *
     * ``` kotlin
     * ```
     *     fun <A> State<A>.observeBuild(block: BuildScope.(A) -> Unit = {}): Job = launchScope {
     *         block(sample())
     *         changes.observeBuild(block)
@@ -698,7 +698,7 @@ interface BuildScope : HasNetwork, StateScope {
 * outside of the current Kairos transaction; when it completes, the returned [Events] emits in a
 * new transaction.
 *
 * ``` kotlin
 * ```
 *   fun <A> BuildScope.asyncEvent(block: suspend () -> A): Events<A> =
 *       events { emit(block()) }.apply { observe() }
 * ```
@@ -719,7 +719,7 @@ fun <A> BuildScope.asyncEvent(block: suspend () -> A): Events<A> =
 * executed if this [BuildScope] is still active by that time. It can be deactivated due to a
 * -Latest combinator, for example.
 *
 * ``` kotlin
 * ```
 *   fun BuildScope.effect(
 *       context: CoroutineContext = EmptyCoroutineContext,
 *       block: EffectScope.() -> Unit,
@@ -740,7 +740,7 @@ fun BuildScope.effect(
 * done because the current [BuildScope] might be deactivated within this transaction, perhaps due
 * to a -Latest combinator. If this happens, then the coroutine will never actually be started.
 *
 * ``` kotlin
 * ```
 *   fun BuildScope.launchEffect(block: suspend KairosScope.() -> Unit): Job =
 *       effect { effectCoroutineScope.launch { block() } }
 * ```
@@ -757,7 +757,7 @@ fun BuildScope.launchEffect(block: suspend KairosCoroutineScope.() -> Unit): Job
 * to a -Latest combinator. If this happens, then the coroutine will never actually be started.
 *
 * Shorthand for:
 * ``` kotlin
 * ```
 *   fun <R> BuildScope.asyncEffect(block: suspend KairosScope.() -> R): Deferred<R> =
 *       CompletableDeferred<R>.apply {
 *               effect { effectCoroutineScope.launch { complete(block()) } }
@@ -789,7 +789,7 @@ fun BuildScope.launchScope(block: BuildSpec<*>): Job = asyncScope(block).second
 *
 * By default, [builder] is only running while the returned [Events] is being
 * [observed][BuildScope.observe]. If you want it to run at all times, simply add a no-op observer:
 * ``` kotlin
 * ```
 * events { ... }.apply { observe() }
 * ```
 *
@@ -813,7 +813,7 @@ fun <In, Out> BuildScope.coalescingEvents(
 *
 * By default, [builder] is only running while the returned [Events] is being
 * [observed][BuildScope.observe]. If you want it to run at all times, simply add a no-op observer:
 * ``` kotlin
 * ```
 * events { ... }.apply { observe() }
 * ```
 *
+5 −5
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ class EventsLoop<A> : Events<A>() {
 *
 * Useful for recursive definitions.
 *
 * ``` kotlin
 * ```
 *   fun <A> Lazy<Events<A>>.defer() = deferredEvents { value }
 * ```
 *
@@ -122,7 +122,7 @@ class EventsLoop<A> : Events<A>() {
 *
 * Useful for recursive definitions.
 *
 * ``` kotlin
 * ```
 *   fun <A> DeferredValue<Events<A>>.defer() = deferredEvents { get() }
 * ```
 *
@@ -160,7 +160,7 @@ fun <A, B> Events<A>.mapMaybe(transform: TransactionScope.(A) -> Maybe<B>): Even
 * Returns an [Events] that contains only the non-null results of applying [transform] to each value
 * of the original [Events].
 *
 * ``` kotlin
 * ```
 *  fun <A> Events<A>.mapNotNull(transform: TransactionScope.(A) -> B?): Events<B> =
 *      mapMaybe { if (it == null) absent else present(it) }
 * ```
@@ -201,7 +201,7 @@ fun <A, B> Events<A>.mapCheap(transform: TransactionScope.(A) -> B): Events<B> =
 * Returns an [Events] that invokes [action] before each value of the original [Events] is emitted.
 * Useful for logging and debugging.
 *
 * ``` kotlin
 * ```
 *   fun <A> Events<A>.onEach(action: TransactionScope.(A) -> Unit): Events<A> =
 *       map { it.also { action(it) } }
 * ```
@@ -220,7 +220,7 @@ fun <A> Events<A>.onEach(action: TransactionScope.(A) -> Unit): Events<A> = map
 * Splits an [Events] of pairs into a pair of [Events], where each returned [Events] emits half of
 * the original.
 *
 * ``` kotlin
 * ```
 *   fun <A, B> Events<Pair<A, B>>.unzip(): Pair<Events<A>, Events<B>> {
 *       val lefts = map { it.first }
 *       val rights = map { it.second }
+4 −4
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ fun <A> Events<A>.filter(state: State<Boolean>): Events<A> = filter { state.samp
/**
 * Returns an [Events] containing only values of the original [Events] that are not null.
 *
 * ``` kotlin
 * ```
 *  fun <A> Events<A?>.filterNotNull(): Events<A> = mapNotNull { it }
 * ```
 *
@@ -41,7 +41,7 @@ fun <A> Events<A?>.filterNotNull(): Events<A> = mapCheap { it.toMaybe() }.filter
/**
 * Returns an [Events] containing only values of the original [Events] that are instances of [A].
 *
 * ``` kotlin
 * ```
 *   inline fun <reified A> Events<*>.filterIsInstance(): Events<A> =
 *       mapNotNull { it as? A }
 * ```
@@ -55,7 +55,7 @@ inline fun <reified A> Events<*>.filterIsInstance(): Events<A> =
/**
 * Returns an [Events] containing only values of the original [Events] that are present.
 *
 * ``` kotlin
 * ```
 *  fun <A> Events<Maybe<A>>.filterPresent(): Events<A> = mapMaybe { it }
 * ```
 *
@@ -69,7 +69,7 @@ fun <A> Events<Maybe<A>>.filterPresent(): Events<A> =
 * Returns an [Events] containing only values of the original [Events] that satisfy the given
 * [predicate].
 *
 * ``` kotlin
 * ```
 *   fun <A> Events<A>.filter(predicate: TransactionScope.(A) -> Boolean): Events<A> =
 *       mapMaybe { if (predicate(it)) present(it) else absent }
 * ```
+3 −3
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ fun <K, A> Events<Map<K, A>>.groupByKey(numKeys: Int? = null): GroupedEvents<K,
 * downstream [Events]. The downstream [Events] are associated with a [key][K], which is derived
 * from each emission of the original [Events] via [extractKey].
 *
 * ``` kotlin
 * ```
 *   fun <K, A> Events<A>.groupBy(
 *       numKeys: Int? = null,
 *       extractKey: TransactionScope.(A) -> K,
@@ -108,7 +108,7 @@ class GroupedEvents<in K, out A> internal constructor(internal val impl: DemuxIm
 * Using this is equivalent to `upstream.filter(predicate) to upstream.filter { !predicate(it) }`
 * but is more efficient; specifically, [partition] will only invoke [predicate] once per element.
 *
 * ``` kotlin
 * ```
 *   fun <A> Events<A>.partition(
 *       predicate: TransactionScope.(A) -> Boolean
 *   ): Pair<Events<A>, Events<A>> =
@@ -133,7 +133,7 @@ fun <A> Events<A>.partition(
 * [First]s and once for [Second]s, but is slightly more efficient; specifically, the
 * [filterIsInstance] check is only performed once per element.
 *
 * ``` kotlin
 * ```
 *   fun <A, B> Events<Either<A, B>>.partitionEither(): Pair<Events<A>, Events<B>> =
 *     map { it.asThese() }.partitionThese()
 * ```
+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ fun <K, V> incrementalOf(value: Map<K, V>): Incremental<K, V> {
 *
 * Useful for recursive definitions.
 *
 * ``` kotlin
 * ```
 *   fun <A> Lazy<Incremental<K, V>>.defer() = deferredIncremental { value }
 * ```
 */
@@ -78,7 +78,7 @@ fun <K, V> Lazy<Incremental<K, V>>.defer(): Incremental<K, V> = deferInline { va
 *
 * Useful for recursive definitions.
 *
 * ``` kotlin
 * ```
 *   fun <A> DeferredValue<Incremental<K, V>>.defer() = deferredIncremental { get() }
 * ```
 */
Loading