使用硬件加速Tokio - 戴翔
第三届中国 Rust 开发者大会 使用硬件加速 Tokio 演讲人: Loong.Dai, Cathy.Lu Loong Dai • Intel 云原生工程师 • 微软 MVP • Dapr 、 Thanos 、 Golangci-lint 的 Maintainer • 现在主要专注于服务网格领域,探索云原生软硬件结 合新范式 • Github ID: daixiang0 自我介绍 , and they haven't chosen to lock- in a specific runtime. Why need Tokio? Rust does not provide async runtime in std lib Tokio gets the biggest support from the community, and has many sponsors (such (such as Discord, Fly.io, and Embark), even it has paid contributors! Tokio is good enough Tokio Tokio's APIs are memory-safe, thread-safe, and misuse-resistant. This helps prevent common bugs,0 码力 | 17 页 | 1.66 MB | 1 年前3Comprehensive Rust(Ukrainian) 202412
приклади в src/main.rs, щоб поекспериментувати з ними: cargo init concurrency cd concurrency cargo add tokio --features full cargo run Структура курсу • Ранок (3 години та 20 хвилин, включаючи перерви) Сегмент можливо (але рідко) реалізувати Future для ваших власних типів. Наприклад, JoinHandle, отриманий від tokio::spawn, реалізує Future, щоб дозволити приєднання до нього. Ключове слово .await, застосоване до ф’ючерсів (виконавець). Rust не має ”вбудованого” середовища виконання, але доступні кілька варіантів: • Tokio: ефективний, із добре розвиненою екосистемою функціональності, наприклад Hyper для HTTP або Tonic0 码力 | 396 页 | 1.08 MB | 10 月前3Comprehensive Rust(Persian ) 202412
3 Runtimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 64.3.1 Tokio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 64.4 Task . . . . . . � � � � � � � � � � � � � � � � � � � � � � � : cargo init concurrency cd concurrency cargo add tokio --features full cargo run � � � � � � � � � : • � � � ) � � � � � � �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � . � � � � � � � � � JoinHandle � � � � � � � � � � � � � � tokio::spawn Future � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ) joining ( � � � � � � �0 码力 | 393 页 | 987.97 KB | 10 月前3Comprehensive Rust ?
3 Runtimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 64.3.1 Tokio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 64.4 Tasks . . . . . . examples into src/main.rs to experiment with them: cargo init concurrency cd concurrency cargo add tokio --features full cargo run Course schedule: • Morning (3 hours and 20 minutes, including breaks) (but uncommon) to implement Future for your own types. For example, the JoinHandle returned from tokio::spawn implements Future to allow joining to it. The .await keyword, applied to a Future, causes0 码力 | 378 页 | 1009.46 KB | 1 年前3Comprehensive Rust(English) 202412
3 Runtimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 63.3.1 Tokio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 63.4 Tasks . . . . . . examples into src/main.rs to experiment with them: cargo init concurrency cd concurrency cargo add tokio --features full cargo run Course schedule: • Morning (3 hours and 20 minutes, including breaks) (but uncommon) to implement Future for your own types. For example, the JoinHandle returned from tokio::spawn implements Future to allow joining to it. The .await keyword, applied to a Future, causes0 码力 | 382 页 | 1.00 MB | 10 月前3Comprehensive Rust(简体中文) 202412
3 Runtimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 63.3.1 Tokio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 63.4 任务 . . . . . . . crate,下载所需的依赖项,做好课前准备。然后,你可以将示例复制/粘贴到 src/main.rs 中,以便对以下代码进行实验: cargo init concurrency cd concurrency cargo add tokio --features full cargo run 课程形式 本课程的互动性非常强,建议你以问题驱动探索 Rust! 1.2 键盘快捷键 mdBook 中有一些实用键盘快捷键: • Arrow-Left pub enum Poll{ Ready(T), Pending, } 异步函数会返回 impl Future。对于自定义的类型,也可以实现 Future(但不常见)。例如,从 tokio::spawn 返回的 JoinHandle 会实现 Future,以允许加入该任务。 在 Future 中使用 .await 关键字会导致当前异步函数暂停,直到该 Future 准备就绪,然后计算其输 0 码力 | 359 页 | 1.33 MB | 10 月前3Comprehensive Rust(Español) 202412
64.3 Runtimes (Tiempos de Ejecución) . . . . . . . . . . . . . . . . . . . . . . . . 357 64.3.1 Tokio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 64.4 Tasks . . . . . . ejemplos en src/main.rs para experimentar con ellos: cargo init concurrency cd concurrency cargo add tokio --features full cargo run Horario del curso: • Mañana (3 horas y205 minutos, incluidos los descansos) no es habitual) implementar Future para tus propios tipos. Por ejemplo, el JoinHandle devuelto por tokio::spawn implementa Future para permitir que se una a él. La palabra clave .await, aplicada a un futuro0 码力 | 389 页 | 1.04 MB | 10 月前3Comprehensive Rust(繁体中文)
3 Runtimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 63.3.1 Tokio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 63.4 工作 . . . . . . . Crate,然後下載並準備執行依附元件。接著就能將範例複製貼上至 src/main.rs, 使用這些範例進行實驗: cargo init concurrency cd concurrency cargo add tokio --features full cargo run 形式 本課程極具互動性,因此建議您根據各項疑問,帶領學員瞭解 Rust! 1.2 鍵盤快速鍵 以下為 mdBook 中實用的鍵盤快速鍵: pub enum Poll{ Ready(T), Pending, } 非同步函式會傳回 impl Future。您也可以為自己的型別實作 Future,但不常見。舉例來說,從 tokio::spawn 傳回的 JoinHandle 會實作 Future,以便允許會合。 套用至 Future 的 .await 關鍵字會暫停目前的非同步函式,直到 Future 準備就緒,接著則會計算其輸 0 码力 | 358 页 | 1.41 MB | 10 月前3Comprehensive Rust(Português do Brasil) 202412
64.3 Tempos de Execução . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 64.3.1 Tokio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 64.4 Tarefas . . . . . exemplos para src/main.rs para experimentá-los: cargo init concurrency cd concurrency cargo add tokio --features full cargo run Agenda do curso: • Morning (3 hours and 20 minutes, including breaks) pouco comum) implementar Future para seus próprios tipos. Por exemplo, o JoinHandle retornado de tokio::spawn implementa Future para permitir juntar-se a ele. A palavra-chave .await, aplicada a uma Future0 码力 | 389 页 | 1.05 MB | 10 月前3Comprehensive Rust(繁体中文) 202406
3 Runtimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 63.3.1 Tokio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 63.4 工作 . . . . . . . Crate,然後下載並準備執行依附元件。接著就能將範例複製貼上至 src/main.rs, 使用這些範例進行實驗: cargo init concurrency cd concurrency cargo add tokio --features full cargo run 形式 本課程極具互動性,因此建議您根據各項疑問,帶領學員瞭解 Rust! 1.2 鍵盤快速鍵 以下為 mdBook 中實用的鍵盤快速鍵: pub enum Poll{ Ready(T), Pending, } 非同步函式會傳回 impl Future。您也可以為自己的型別實作 Future,但不常見。舉例來說,從 tokio::spawn 傳回的 JoinHandle 會實作 Future,以便允許會合。 套用至 Future 的 .await 關鍵字會暫停目前的非同步函式,直到 Future 準備就緒,接著則會計算其輸 0 码力 | 356 页 | 1.41 MB | 1 年前3
共 60 条
- 1
- 2
- 3
- 4
- 5
- 6