async-rs/async-std

「 Async version of the Rust standard library 」

中文 | english


校对 ✅

翻译的原文 与日期 最新更新 更多
commit ⏰ 2019-11-19 last 中文翻译

贡献

欢迎 👏 勘误/校对/更新贡献 😊 具体贡献请看

生活

If help, buy me coffee —— 营养跟不上了,给我来瓶营养快线吧! 💰


async-std

Async version of the Rust standard library



此箱子提供异步版本的std。它提供了您惯用的所有接口,不同的是,它是异步版本,可使用 Rust 的async/await语法。

特征

  • 现代: 从头到std::futureasync/await开始构建,快速的编译时间。
  • 快速:我们强大的分配器和线程池设计,可提供超高吞吐量,并具有可预见的低延迟。
  • 直观:与 stdlib 的完全对等,意味着您只需要学习一次 API。
  • 明确: 详细文档无障碍指南让,使用异步 Rust 从未如此简单。

例子

  1. use async_std::task;
  2. fn main() {
  3. task::block_on(async {
  4. println!("Hello, world!");
  5. })
  6. }

在我们的网站中,可以在examples目录找到更多示例,包括网络和文件访问。

哲学

我们认为 Async Rust 应该像 Sync Rust 一样容易上手。我们也相信最好的 API 是您已经知道的 API。最后,我们认为为标准库提供异步副本是最好的做法,而 stdlib 成为性能和生产力两点上,一个可靠的基石。

Async-std 是该愿景的体现。它结合了,单-分配任务的创建,自适应无锁执行器,线程池和网络驱动程序,且使用 Rust 熟悉的 stdlib API,而这样的一个平滑系统,是以如此低延迟的高速度处理工作。

安装

cargo add安装运行:

  1. $ cargo add async-std

我们还通过 async-std 提供了一组“不稳定”功能。见功能文档中,了解如何启用它们的信息。

执照

Licensed under either of Apache License, Version 2.0 or MIT license at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.