Last active
February 26, 2017 13:57
-
-
Save nsmaciej/2eb72bde56539e0aaca1afabeab33b58 to your computer and use it in GitHub Desktop.
Panic while getting remote
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| authors = ["mgoszcz2"] | |
| name = "reactor" | |
| version = "0.1.0" | |
| [dependencies] | |
| futures = "0.1.10" | |
| tokio-core = "0.1.4" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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