[][src]Function smol::future::poll_once

pub fn poll_once<T, F>(f: F) -> PollOnce<F>

Notable traits for PollOnce<F>

impl<T, F> Future for PollOnce<F> where
    F: Future<Output = T>, 
type Output = Option<T>;
where
    F: Future<Output = T>, 

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

Examples

use futures_lite::*;

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