Add Debug for {Handle,Remote,Core}

Closes #170
This commit is contained in:
Alex Crichton 2017-03-06 12:15:29 -08:00
parent bd75a522c3
commit 5c411c548b

View File

@ -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<AtomicUsize>, 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<Task> {
match *self {