futures-polling

Crates.iofutures-polling
lib.rsfutures-polling
version0.1.1
sourcesrc
created_at2020-08-31 18:42:55.663066
updated_at2020-09-04 14:20:23.269151
descriptionAn enum similar to Poll, but containing a future in its Pending variant
homepagehttps://github.com/r3v2d0g/futures-polling
repositoryhttps://git.r3vd5u3d.network/~r3v2d0g/futures-polling
max_upload_size
id283188
size70,651
Matthieu Le brazidec (r3v2d0g) (r3v2d0g)

documentation

https://docs.rs/futures-polling

README

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/.

Commit count: 0

cargo fmt