Skip to content

Instantly share code, notes, and snippets.

@nsmaciej
Last active February 26, 2017 13:57
Show Gist options
  • Save nsmaciej/2eb72bde56539e0aaca1afabeab33b58 to your computer and use it in GitHub Desktop.
Save nsmaciej/2eb72bde56539e0aaca1afabeab33b58 to your computer and use it in GitHub Desktop.
Panic while getting remote
[package]
authors = ["mgoszcz2"]
name = "reactor"
version = "0.1.0"
[dependencies]
futures = "0.1.10"
tokio-core = "0.1.4"
extern crate tokio_core;
extern crate futures;
use tokio_core::reactor;
use futures::{Future, BoxFuture};
use futures::future::ok;
fn handler(handle: reactor::Remote) -> BoxFuture<(), ()> {
handle.handle().unwrap(); // Panics here
ok(()).boxed()
}
fn main() {
let mut core = reactor::Core::new().unwrap();
let remote = core.remote();
assert!(Ok(()) == core.run(handler(remote)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment