Skip to content

Commit 6de5151

Browse files
committed
Implement Debug for Task
1 parent 9c52450 commit 6de5151

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/task/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use std::prelude::v1::*;
3131

3232
use std::cell::Cell;
33+
use std::fmt;
3334
use std::sync::Arc;
3435
use std::sync::atomic::{Ordering, AtomicUsize, ATOMIC_USIZE_INIT};
3536
use std::thread;
@@ -157,6 +158,14 @@ impl Task {
157158
}
158159
}
159160

161+
impl fmt::Debug for Task {
162+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
163+
f.debug_struct("Task")
164+
.field("id", &self.id)
165+
.finish()
166+
}
167+
}
168+
160169
/// Representation of a spawned future/stream.
161170
///
162171
/// This object is returned by the `spawn` function in this module. This

0 commit comments

Comments
 (0)