Unified · Split
| @@ -14,13 +14,13 @@ mod _impl { · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | /// Initialize a signal handler to listen to SIGINT and SIGTERM and trigger our [`trigger()`][super::trigger()] that way. |
| 16 | 16 | /// |
| 17 | − /// When `Ctrl+C` is pressed, a message will be sent to `message_channel` to inform the user about it being registered, after all | |
| 17 | + /// When `Ctrl+C` is pressed, a message will be sent to `out` to inform the user about it being registered, after all | |
| 18 | 18 | /// actually responding to it is implementation dependent and might thus take some time (or not work at all). |
| 19 | 19 | /// |
| 20 | 20 | /// # Note |
| 21 | 21 | /// |
| 22 | 22 | /// This implementation is available only with the **interrupt-handler** feature toggle with the **disable-interrupts** feature disabled. |
| 23 | − pub fn init_handler(mut message_channel: impl io::Write + Send + 'static) { | |
| 23 | + pub fn init_handler(mut out: impl io::Write + Send + 'static) { | |
| 24 | 24 | ctrlc::set_handler(move || { |
| 25 | 25 | const MESSAGES: &[&str] = &[ |
| 26 | 26 | "interrupt requested", |
| @@ -34,7 +34,7 @@ mod _impl { · 7 unmodified lines | ||
| 34 | 34 | } |
| 35 | 35 | let msg_idx = CURRENT_MESSAGE.fetch_add(1, Ordering::Relaxed); |
| 36 | 36 | super::IS_INTERRUPTED.store(true, Ordering::Relaxed); |
| 37 | − writeln!(message_channel, "{}", MESSAGES[msg_idx % MESSAGES.len()]).ok(); | |
| 37 | + writeln!(out, "{}", MESSAGES[msg_idx % MESSAGES.len()]).ok(); | |
| 38 | 38 | }) |
| 39 | 39 | .expect("it is up to the application to ensure only one interrupt handler is installed, and this function is called only once.") |
| 40 | 40 | } |
| @@ -48,7 +48,7 @@ mod _impl { · 7 unmodified lines | ||
| 48 | 48 | use std::io; |
| 49 | 49 | |
| 50 | 50 | /// Does nothing, as the **disable-interrupts** feature is enabled while the **interrupt-handler** feature is not present. |
| 51 | − pub fn init_handler(_message_channel: impl io::Write + Send + 'static) {} | |
| 51 | + pub fn init_handler(_out: impl io::Write + Send + 'static) {} | |
| 52 | 52 | } |
| 53 | 53 | pub use _impl::init_handler; |
| 54 | 54 | |