Function rxrust::observable::defer [−][src]
pub fn defer<F, U>(observable_supplier: F) -> ObservableDeref<F> where
F: FnOnce() -> U,
Expand description
Creates an observable that will on subscription defer to another observable that is supplied by a supplier-function which will be run once at each subscription
observable::defer(|| {
println!("Hi!");
observable::of("Hello!")
})
.subscribe(move |v| {
println!("{}", v);
});
// Prints: Hi!\nHello!\n