Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
examples/ | H | 03-May-2022 | - | 173 | 107 | |
src/ | H | 03-May-2022 | - | 1,010 | 590 | |
tests/ | H | 03-May-2022 | - | 259 | 187 | |
.cargo-checksum.json | H A D | 03-May-2022 | 89 | 1 | 1 | |
.cargo_vcs_info.json | H A D | 05-Feb-2020 | 74 | 6 | 5 | |
CHANGELOG.md | H A D | 04-Feb-2020 | 1.4 KiB | 56 | 41 | |
Cargo.lock | H A D | 05-Feb-2020 | 14.3 KiB | 599 | 539 | |
Cargo.toml | H A D | 05-Feb-2020 | 1.6 KiB | 56 | 47 | |
Cargo.toml.orig-cargo | H A D | 04-Feb-2020 | 1.1 KiB | 44 | 38 | |
LICENSE | H A D | 04-Feb-2020 | 1 KiB | 26 | 22 | |
README.md | H A D | 04-Feb-2020 | 1.4 KiB | 56 | 37 |
README.md
1# tokio-signal 2 3Unix signal handling for Tokio. 4 5> **Note:** This crate is **deprecated in tokio 0.2.x** and has been moved into 6> [`tokio::signal`] behind the `signal` [feature flag]. 7 8[`tokio::signal`]: https://docs.rs/tokio/latest/tokio/signal/index.html 9[feature flag]: https://docs.rs/tokio/latest/tokio/index.html#feature-flags 10 11[Documentation](https://docs.rs/tokio-signal/0.2.8/tokio_signal) 12 13## Usage 14 15First, add this to your `Cargo.toml`: 16 17```toml 18[dependencies] 19tokio-signal = "0.2.8" 20``` 21 22Next you can use this in conjunction with the `tokio` and `futures` crates: 23 24```rust,no_run 25extern crate futures; 26extern crate tokio; 27extern crate tokio_signal; 28 29use futures::{Future, Stream}; 30 31fn main() { 32 33 // Create an infinite stream of "Ctrl+C" notifications. Each item received 34 // on this stream may represent multiple ctrl-c signals. 35 let ctrl_c = tokio_signal::ctrl_c().flatten_stream(); 36 37 // Process each ctrl-c as it comes in 38 let prog = ctrl_c.for_each(|()| { 39 println!("ctrl-c received!"); 40 Ok(()) 41 }); 42 43 tokio::run(prog.map_err(|err| panic!("{}", err))); 44} 45``` 46 47## License 48 49This project is licensed under the [MIT license](./LICENSE). 50 51### Contribution 52 53Unless you explicitly state otherwise, any contribution intentionally submitted 54for inclusion in Tokio by you, shall be licensed as MIT, without any additional 55terms or conditions. 56