Improve wording in README
This commit is contained in:
parent
0df4c62d4f
commit
94bccacb2d
14
README.md
14
README.md
@ -148,7 +148,8 @@ resources on the topic of monad comprehensions.
|
|||||||
|
|
||||||
#### Coroutine Support
|
#### Coroutine Support
|
||||||
|
|
||||||
Use of coroutines within a `binding` block requires an additional dependency:
|
Use of suspending functions within a `binding` block requires an additional
|
||||||
|
dependency:
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -157,11 +158,16 @@ dependencies {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
This allows for asynchronous binds to operate so that if a bind were to fail,
|
The coroutine implementation of `binding` has been designed so that the first
|
||||||
the binding block will return with the first failing async result:
|
call to `bind()` that fails will cancel all child coroutines within the current
|
||||||
|
coroutine scope.
|
||||||
|
|
||||||
|
The example below demonstrates a computationally expensive function that takes
|
||||||
|
five milliseconds to compute being eagerly cancelled as soon as a smaller
|
||||||
|
function fails in just one millisecond:
|
||||||
|
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
|
|
||||||
suspend fun failsIn5ms(): Result<Int, DomainErrorA> { ... }
|
suspend fun failsIn5ms(): Result<Int, DomainErrorA> { ... }
|
||||||
suspend fun failsIn1ms(): Result<Int, DomainErrorB> { ... }
|
suspend fun failsIn1ms(): Result<Int, DomainErrorB> { ... }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user