Skip to content

Instantly share code, notes, and snippets.

@tobz
Last active April 4, 2018 18:14
Show Gist options
  • Save tobz/0d8461ebbab916f7792cd04b6473a3c5 to your computer and use it in GitHub Desktop.
Save tobz/0d8461ebbab916f7792cd04b6473a3c5 to your computer and use it in GitHub Desktop.
error[E0271]: type mismatch resolving `<futures::Map<futures::Receiver<()>, [closure@src/main.rs:118:18: 121:14]> as futures::Future>::Error == ()`
--> src/main.rs:122:9
|
122 | tokio::spawn(signal_handler);
| ^^^^^^^^^^^^ expected struct `futures::Canceled`, found ()
|
= note: expected type `futures::Canceled`
found type `()`
= note: required by `tokio::spawn`
fn run(signal_rx: oneshot::Receiver::<()>) -> Result<()> {
tokio::run(future::lazy(|| {
// sit on signal_rx until the sender triggers us, but also log when that happens
let signal_handler = signal_rx
.map(|sig| {
info!("we should be closing");
()
});
tokio::spawn(signal_handler);
Ok(())
}));
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment