From 5c411c548b32e1668dd4712c05e62ef24ba0fcc8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 6 Mar 2017 12:15:29 -0800 Subject: [PATCH] Add Debug for {Handle,Remote,Core} Closes #170 --- src/reactor/mod.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/reactor/mod.rs b/src/reactor/mod.rs index afa4daeb7..23d93bc45 100644 --- a/src/reactor/mod.rs +++ b/src/reactor/mod.rs @@ -6,6 +6,7 @@ use std::cell::RefCell; use std::cmp; +use std::fmt; use std::io::{self, ErrorKind}; use std::mem; use std::rc::{Rc, Weak}; @@ -436,6 +437,14 @@ impl Core { } } +impl fmt::Debug for Core { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Core") + .field("id", &self.id()) + .finish() + } +} + impl Inner { fn add_source(&mut self, source: &mio::Evented) -> io::Result<(Arc, usize)> { @@ -635,6 +644,14 @@ impl Remote { } } +impl fmt::Debug for Remote { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Remote") + .field("id", &self.id()) + .finish() + } +} + impl Handle { /// Returns a reference to the underlying remote handle to the event loop. pub fn remote(&self) -> &Remote { @@ -671,6 +688,14 @@ impl Handle { } } +impl fmt::Debug for Handle { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Handle") + .field("id", &self.id()) + .finish() + } +} + impl TimeoutState { fn block(&mut self, handle: Task) -> Option { match *self {