#future #async-await #await #async

futures-polling

An enum similar to Poll, but containing a future in its Pending variant

Show the crate…

3 unstable releases

0.1.1 Sep 4, 2020
0.1.0 Sep 4, 2020
0.0.0 Aug 31, 2020

#95 in #await

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

64 downloads per month
Used in 6 crates (via bevy_flurx)

MPL-2.0 license

52KB
237 lines

An enum similar to Poll, but containing a future in its Pending variant

img img img

Example

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);

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


lib.rs:

An enum similar to Poll, but containing a future in its Pending variant.

Example

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);
#

No runtime deps