diff options
Diffstat (limited to 'crates/core/tedge_lib/src/mainloop/stopper.rs')
-rw-r--r-- | crates/core/tedge_lib/src/mainloop/stopper.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/core/tedge_lib/src/mainloop/stopper.rs b/crates/core/tedge_lib/src/mainloop/stopper.rs new file mode 100644 index 00000000..d2ffa75c --- /dev/null +++ b/crates/core/tedge_lib/src/mainloop/stopper.rs @@ -0,0 +1,13 @@ +pub struct MainloopStopper(pub(super) tedge_api::CancellationToken); + +impl MainloopStopper { + pub fn stop(self) { + self.0.cancel(); + } +} + +impl std::fmt::Debug for MainloopStopper { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("MainloopStopper").finish() + } +} |