#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

#101 in #await

Download history 34/week @ 2024-07-29 98/week @ 2024-08-05 49/week @ 2024-08-12 29/week @ 2024-08-19 29/week @ 2024-08-26 3/week @ 2024-09-02 37/week @ 2024-09-16 36/week @ 2024-09-23 22/week @ 2024-09-30 15/week @ 2024-10-07 33/week @ 2024-10-14 7/week @ 2024-10-21 13/week @ 2024-10-28 16/week @ 2024-11-04 20/week @ 2024-11-11

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