Function futures::future::lazy [−][src]
pub fn lazy<F, R>(f: F) -> Lazy<F> where
F: FnOnce(&mut Context) -> R,
Creates a new future from a closure.
The provided closure is only run once the future is polled.
Examples
use futures::prelude::*; use futures::future; let a = future::lazy(|_| 1); let b = future::lazy(|_| -> i32 { panic!("oh no!") }); drop(b); // closure is never run