bevy_tasks

Function poll_once

Source
pub fn poll_once<T, F>(f: F) -> PollOnce<F>
where F: Future<Output = T>,
Expand description

Polls a future just once and returns an Option with the result.

ยงExamples

use futures_lite::future;

assert_eq!(future::poll_once(future::pending::<()>()).await, None);
assert_eq!(future::poll_once(future::ready(42)).await, Some(42));