Skip to content

Commit

Permalink
Update all examples with Knit tool (imports)
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed Mar 17, 2017
1 parent f1572ca commit 95981f3
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
// This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit.
package guide.channel.example03

import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*

fun produceSquares() = produce<Int>(CommonPool) {
for (x in 1..5) send(x * x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@
// This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit.
package guide.channel.example06

import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*

fun produceNumbers() = produce<Int>(CommonPool) {
var x = 1 // start from 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@
// This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit.
package guide.select.example03

import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.channels.SendChannel
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.selects.select
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.experimental.selects.*

fun produceNumbers(side: SendChannel<Int>) = produce<Int>(CommonPool) {
for (num in 1..10) { // produce 10 numbers from 1 to 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.basic.example01

import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*

fun main(args: Array<String>) = runBlocking<Unit> {
// create a channel that produces numbers from 1 to 3 with 200ms delays between them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.basic.example02

import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.reactive.consumeEach
import kotlinx.coroutines.experimental.reactive.publish
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*

fun main(args: Array<String>) = runBlocking<Unit> {
// create a publisher that produces numbers from 1 to 3 with 200ms delays between them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.basic.example03

import io.reactivex.Flowable
import kotlinx.coroutines.experimental.reactive.open
import kotlinx.coroutines.experimental.runBlocking
import io.reactivex.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*

fun main(args: Array<String>) = runBlocking<Unit> {
val source = Flowable.range(1, 5) // a range of five numbers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.basic.example04

import io.reactivex.Flowable
import kotlinx.coroutines.experimental.reactive.consumeEach
import kotlinx.coroutines.experimental.runBlocking
import io.reactivex.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*

fun main(args: Array<String>) = runBlocking<Unit> {
val source = Flowable.range(1, 5) // a range of five numbers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.context.example01

import io.reactivex.Flowable
import io.reactivex.Scheduler
import io.reactivex.*
import io.reactivex.functions.BiFunction
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.context.example02

import io.reactivex.Flowable
import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.reactive.publish
import io.reactivex.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*
import kotlin.coroutines.experimental.CoroutineContext

fun rangeWithInterval(context: CoroutineContext, time: Long, start: Int, count: Int) = publish<Int>(context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.context.example03

import io.reactivex.Flowable
import io.reactivex.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.reactive.publish
import kotlin.coroutines.experimental.CoroutineContext

fun rangeWithInterval(context: CoroutineContext, time: Long, start: Int, count: Int) = publish<Int>(context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.context.example04

import io.reactivex.Flowable
import io.reactivex.Scheduler
import io.reactivex.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*
import io.reactivex.functions.BiFunction
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.experimental.reactive.consumeEach
import kotlinx.coroutines.experimental.runBlocking
import java.util.concurrent.TimeUnit

fun rangeWithIntervalRx(scheduler: Scheduler, time: Long, start: Int, count: Int): Flowable<Int> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.context.example05

import io.reactivex.Flowable
import io.reactivex.Scheduler
import io.reactivex.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*
import io.reactivex.functions.BiFunction
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.experimental.Unconfined
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.reactive.consumeEach
import kotlinx.coroutines.experimental.runBlocking
import java.util.concurrent.TimeUnit

fun rangeWithIntervalRx(scheduler: Scheduler, time: Long, start: Int, count: Int): Flowable<Int> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.operators.example01

import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.reactive.consumeEach
import kotlinx.coroutines.experimental.reactive.publish
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*
import kotlin.coroutines.experimental.CoroutineContext

fun range(context: CoroutineContext, start: Int, count: Int) = publish<Int>(context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.operators.example02

import kotlinx.coroutines.experimental.reactive.consumeEach
import kotlinx.coroutines.experimental.reactive.publish
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*
import org.reactivestreams.Publisher
import kotlin.coroutines.experimental.CoroutineContext

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.operators.example03

import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.reactive.consumeEach
import kotlinx.coroutines.experimental.reactive.open
import kotlinx.coroutines.experimental.reactive.publish
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.selects.whileSelect
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*
import org.reactivestreams.Publisher
import kotlin.coroutines.experimental.CoroutineContext
import kotlinx.coroutines.experimental.selects.whileSelect

fun <T, U> Publisher<T>.takeUntil(context: CoroutineContext, other: Publisher<U>) = publish<T>(context) {
this@takeUntil.open().use { thisChannel -> // explicitly open channel to Publisher<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
package guide.reactive.operators.example04

import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.reactive.consumeEach
import kotlinx.coroutines.experimental.reactive.publish
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.reactive.*
import org.reactivestreams.Publisher
import kotlin.coroutines.experimental.CoroutineContext

Expand Down

0 comments on commit 95981f3

Please sign in to comment.