Skip to content

Commit

Permalink
Merge pull request #2 from svanharmelen/bugfix/clone
Browse files Browse the repository at this point in the history
Implement Clone and Debug for Shutdown
  • Loading branch information
svanharmelen committed Sep 26, 2023
2 parents 618f3c1 + 5a10d2a commit aecd787
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "shutdown"
version = "0.3.0"
version = "0.3.1"
authors = ["Sander van Harmelen <sander@vanharmelen.nl>"]
edition = "2021"
description = "shutdown can be used to gracefully exit (part of) a running program"
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Expand Up @@ -26,10 +26,17 @@ use signal_hook::{
use signal_hook_tokio::Signals;
use tokio_util::sync::CancellationToken;

#[derive(Debug)]
pub struct Shutdown {
token: CancellationToken,
}

impl Clone for Shutdown {
fn clone(&self) -> Self {
self.subscribe()
}
}

impl Shutdown {
/// Create a new shutdown signal. In most cases the signal will be
/// triggered when CTRL-C is pressed and the process receives a SIGINT or
Expand Down

0 comments on commit aecd787

Please sign in to comment.