diff --git a/Cargo.toml b/Cargo.toml index 17460e9..73d1379 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drain" -version = "0.1.1" +version = "0.1.2" authors = ["Linkerd Developers "] license = "Apache-2.0" edition = "2018" diff --git a/src/lib.rs b/src/lib.rs index b2f1fd6..aee4fad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,6 @@ pub fn channel() -> (Signal, Watch) { enum Never {} /// Send a drain command to all watchers. -#[derive(Debug)] pub struct Signal { drained_rx: mpsc::Receiver, signal_tx: watch::Sender<()>, @@ -41,14 +40,14 @@ pub struct Signal { /// /// All `Watch` instances must be dropped for a `Signal::signal` call to /// complete. -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct Watch { drained_tx: mpsc::Sender, signal_rx: watch::Receiver<()>, } #[must_use = "ReleaseShutdown should be dropped explicitly to release the runtime"] -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct ReleaseShutdown(mpsc::Sender); // === impl Signal === @@ -74,6 +73,12 @@ impl Signal { } } +impl std::fmt::Debug for Signal { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Signal").finish_non_exhaustive() + } +} + // === impl Watch === impl Watch { @@ -117,6 +122,12 @@ impl Watch { } } +impl std::fmt::Debug for Watch { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Watch").finish_non_exhaustive() + } +} + impl ReleaseShutdown { /// Releases shutdown after `future` completes. pub async fn release_after(self, future: F) -> F::Output { @@ -125,6 +136,11 @@ impl ReleaseShutdown { res } } +impl std::fmt::Debug for ReleaseShutdown { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("ReleaseShutdown").finish_non_exhaustive() + } +} #[cfg(test)] mod tests {