mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-09 00:00:08 +02:00
Update Tokio to Rust 2018 (#1082)
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
//! A small example of how to listen for two signals at the same time
|
||||
#![deny(warnings, rust_2018_idioms)]
|
||||
|
||||
extern crate futures;
|
||||
extern crate tokio;
|
||||
extern crate tokio_signal;
|
||||
//! A small example of how to listen for two signals at the same time
|
||||
|
||||
// A trick to not fail build on non-unix platforms when using unix-specific features.
|
||||
#[cfg(unix)]
|
||||
@@ -11,7 +9,7 @@ mod platform {
|
||||
use futures::{Future, Stream};
|
||||
use tokio_signal::unix::{Signal, SIGINT, SIGTERM};
|
||||
|
||||
pub fn main() -> Result<(), Box<::std::error::Error>> {
|
||||
pub fn main() -> Result<(), Box<dyn (::std::error::Error)>> {
|
||||
// Create a stream for each of the signals we'd like to handle.
|
||||
let sigint = Signal::new(SIGINT).flatten_stream();
|
||||
let sigterm = Signal::new(SIGTERM).flatten_stream();
|
||||
@@ -44,11 +42,11 @@ mod platform {
|
||||
|
||||
#[cfg(not(unix))]
|
||||
mod platform {
|
||||
pub fn main() -> Result<(), Box<::std::error::Error>> {
|
||||
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<std::error::Error>> {
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
platform::main()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user