|
1 | 1 |
|
2 |
| -Kotlin, as a language, provides only minimal low-level APIs in its standard library to enable various other |
3 |
| -libraries to utilize coroutines. Unlike many other languages with similar capabilities, `async` and `await` |
4 |
| -are not keywords in Kotlin and are not even part of its standard library. Moreover, Kotlin's concept |
5 |
| -of _suspending function_ provides a safer and less error-prone abstraction for asynchronous |
6 |
| -operations than futures and promises. |
| 2 | +Kotlin 是一门只提供最基本底层 API 以便各种其他<!-- |
| 3 | +-->库能够利用协程的语言。与许多其他具有类似功能的语言不同,`async` 与 `await` |
| 4 | +在 Kotlin 中并不是关键字,甚至都不是标准库的一部分。此外,Kotlin 的 |
| 5 | +_挂起函数_ 概念为异步操作提供了比 |
| 6 | +future 与 promise 更安全、不易出错的抽象。 |
7 | 7 |
|
8 |
| -`kotlinx.coroutines` is a rich library for coroutines developed by JetBrains. It contains a number of high-level |
9 |
| -coroutine-enabled primitives that this guide covers, including `launch`, `async` and others. |
| 8 | +`kotlinx.coroutines` 是由 JetBrains 开发的丰富的协程库。它包含<!-- |
| 9 | +-->本指南中涵盖的很多启用高级协程的原语,包括 `launch`、 `async` 等等。 |
10 | 10 |
|
11 |
| -This is a guide on core features of `kotlinx.coroutines` with a series of examples, divided up into different topics. |
| 11 | +本文是关于 `kotlinx.coroutines` 核心特性的指南,包含一系列示例,分为不同的主题。 |
12 | 12 |
|
13 |
| -In order to use coroutines as well as follow the examples in this guide, you need to add a dependency on `kotlinx-coroutines-core` module as explained |
14 |
| -[in the project README ](../README.md#using-in-your-projects). |
| 13 | +为了使用协程以及按照本指南中的示例演练,需要添加对 `kotlinx-coroutines-core` 模块的依赖,如<!-- |
| 14 | +-->[项目中的 README 文件](../README.md#using-in-your-projects)所述。 |
15 | 15 |
|
16 |
| -## Table of contents |
| 16 | +## 目录 |
17 | 17 |
|
18 |
| -* [Coroutine basics](basics.md) |
19 |
| -* [Cancellation and timeouts](cancellation-and-timeouts.md) |
20 |
| -* [Composing suspending functions](composing-suspending-functions.md) |
21 |
| -* [Coroutine context and dispatchers](coroutine-context-and-dispatchers.md) |
22 |
| -* [Exception handling and supervision](exception-handling.md) |
23 |
| -* [Channels (experimental)](channels.md) |
24 |
| -* [Shared mutable state and concurrency](shared-mutable-state-and-concurrency.md) |
25 |
| -* [Select expression (experimental)](select-expression.md) |
| 18 | +* [协程基础](basics.md) |
| 19 | +* [取消与超时](cancellation-and-timeouts.md) |
| 20 | +* [组合挂起函数](composing-suspending-functions.md) |
| 21 | +* [协程上下文与调度器](coroutine-context-and-dispatchers.md) |
| 22 | +* [异常处理与监管](exception-handling.md) |
| 23 | +* [通道(实验性的)](channels.md) |
| 24 | +* [共享的可变状态与并发](shared-mutable-state-and-concurrency.md) |
| 25 | +* [Select 表达式(实验性的)](select-expression.md) |
26 | 26 |
|
27 |
| -## Additional references |
| 27 | +## 其他参考资料 |
28 | 28 |
|
29 |
| -* [Guide to UI programming with coroutines](../ui/coroutines-guide-ui.md) |
30 |
| -* [Guide to reactive streams with coroutines](../reactive/coroutines-guide-reactive.md) |
31 |
| -* [Coroutines design document (KEEP)](https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md) |
32 |
| -* [Full kotlinx.coroutines API reference](http://kotlin.github.io/kotlinx.coroutines) |
| 29 | +* [使用协程进行 UI 编程指南](../ui/coroutines-guide-ui.md) |
| 30 | +* [响应式流与协程指南](../reactive/coroutines-guide-reactive.md) |
| 31 | +* [协程设计文档(KEEP)](https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md) |
| 32 | +* [完整的 kotlinx.coroutines API 参考文档](http://kotlin.github.io/kotlinx.coroutines) |
0 commit comments