docs: fix examples indents (#2222)
This commit is contained in:
committed by
Nikolay Igotti
parent
baf93a6ff0
commit
95ee655fbe
+13
-13
@@ -27,20 +27,20 @@
|
|||||||
<div class="sample" markdown="1" theme="idea" data-highlight-only>
|
<div class="sample" markdown="1" theme="idea" data-highlight-only>
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val future = execute(TransferMode.SAFE, { SomeDataForWorker() }) {
|
val future = execute(TransferMode.SAFE, { SomeDataForWorker() }) {
|
||||||
// data returned by the second function argument comes to the
|
// data returned by the second function argument comes to the
|
||||||
// worker routine as 'input' parameter.
|
// worker routine as 'input' parameter.
|
||||||
input ->
|
input ->
|
||||||
// Here we create an instance to be returned when someone consumes result future.
|
// Here we create an instance to be returned when someone consumes result future.
|
||||||
WorkerResult(input.stringParam + " result")
|
WorkerResult(input.stringParam + " result")
|
||||||
}
|
}
|
||||||
|
|
||||||
future.consume {
|
future.consume {
|
||||||
// Here we see result returned from routine above. Note that future object or
|
// Here we see result returned from routine above. Note that future object or
|
||||||
// id could be transferred to another worker, so we don't have to consume future
|
// id could be transferred to another worker, so we don't have to consume future
|
||||||
// in same execution context it was obtained.
|
// in same execution context it was obtained.
|
||||||
result -> println("result is $result")
|
result -> println("result is $result")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user