#future #async-await #await #async

futures-polling

与 Poll 类似的枚举,但在其 Pending 变体中包含一个未来

显示包…

3 个不稳定版本

0.1.1 2020年9月4日
0.1.0 2020年9月4日
0.0.0 2020年8月31日

#95#await

Download history • Rust 包仓库 5/week @ 2024-03-13 • Rust 包仓库 42/week @ 2024-03-27 • Rust 包仓库 616/week @ 2024-04-03 • Rust 包仓库 110/week @ 2024-04-10 • Rust 包仓库 69/week @ 2024-04-17 • Rust 包仓库 81/week @ 2024-04-24 • Rust 包仓库 74/week @ 2024-05-01 • Rust 包仓库 39/week @ 2024-05-08 • Rust 包仓库 11/week @ 2024-05-15 • Rust 包仓库 38/week @ 2024-05-22 • Rust 包仓库 38/week @ 2024-05-29 • Rust 包仓库 16/week @ 2024-06-05 • Rust 包仓库 18/week @ 2024-06-12 • Rust 包仓库 10/week @ 2024-06-19 • Rust 包仓库 6/week @ 2024-06-26 • Rust 包仓库

每月64 次下载
6 个包中使用 (via bevy_flurx)

MPL-2.0 许可证

52KB
237

与 Poll 类似的枚举,但在其 Pending 变体中包含一个未来

img img img

示例

use futures_lite::future;
use futures_polling::{FuturePollingExt, Polling};

let mut polling = async {
    future::yield_now().await;
    42
}.polling();

assert_eq!(polling.is_pending(), true);

// Poll just once.
polling.polling_once().await;
assert_eq!(polling.is_pending(), true);

// Poll until the inner future is ready.
assert_eq!(polling.await, 42);

许可证

此源代码形式受 Mozilla 公共许可证第 2.0 版的条款约束。如果未随此文件分发 MPL 的副本,您可以在此获取一份:http://mozilla.org/MPL/2.0/


lib.rs:

类似于 Poll 的枚举,但在其 Pending 变体中包含一个 未来

示例

use futures_lite::future;
use futures_polling::{FuturePollingExt, Polling};

#
let mut polling = async {
    future::yield_now().await;
    42
}.polling();

assert_eq!(polling.is_pending(), true);

// Poll just once.
polling.polling_once().await;
assert_eq!(polling.is_pending(), true);

// Poll until the inner future is ready.
assert_eq!(polling.await, 42);
#

无运行时依赖