Function rxrust::observable::from_future[][src]

pub fn from_future<F, Item, S>(f: F, scheduler: S) -> FutureObservable<F, S> where
    F: Future<Output = Item>, 
Expand description

Converts a Future to an observable sequence. Even though if the future poll value has Result::Err type, also emit as a normal value, not trigger to error handle.

use futures::{future, executor::LocalPool};
let mut local_scheduler = LocalPool::new();

observable::from_future(future::ready(1), local_scheduler.spawner())
  .subscribe(move |v| {
    println!("subscribed {}", v);
  });

local_scheduler.run();

If your Future poll an Result type value, and you want dispatch the error by rxrust, you can use from_future_result