[−][src]Function async_fuse::once
pub fn once<T>(value: T) -> Once<T>ⓘ where
T: Future,
Construct a fusing adapter that is capable of polling an interior future.
Once the future completes, the adapter will switch to an empty state and return Poll::Pending until [set][Once::set] again.
Examples
use std::time::Duration; use tokio::time; let mut sleep = async_fuse::once(time::sleep(Duration::from_millis(200))); tokio::pin!(sleep); tokio::select! { _ = &mut sleep => { assert!(sleep.is_empty()); sleep.set(async_fuse::once(time::sleep(Duration::from_millis(200)))); } } assert!(!sleep.is_empty());