Skip to content

Commit dc82d03

Browse files
author
Jonathan Woollett-Light
committed
fix: missing_debug_implementations
Signed-off-by: Jonathan Woollett-Light <[email protected]>
1 parent 5800e90 commit dc82d03

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![warn(missing_debug_implementations)]
2+
13
use std::collections::HashMap;
24
use std::os::unix::io::{AsRawFd, RawFd};
35

@@ -11,6 +13,7 @@ fn errno() -> i32 {
1113
unsafe { *libc::__errno_location() }
1214
}
1315

16+
#[derive(Debug)]
1417
pub struct BufferedEventManager {
1518
event_manager: EventManager,
1619
// TODO The length is always unused, a custom type could thus save `size_of::<usize>()` bytes.
@@ -91,6 +94,22 @@ pub struct EventManager {
9194
events: HashMap<RawFd, Action>,
9295
}
9396

97+
impl std::fmt::Debug for EventManager {
98+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
99+
f.debug_struct("EventManager")
100+
.field("epfd", &self.epfd)
101+
.field(
102+
"events",
103+
&self
104+
.events
105+
.iter()
106+
.map(|(k, v)| (*k, v as *const _ as usize))
107+
.collect::<HashMap<_, _>>(),
108+
)
109+
.finish()
110+
}
111+
}
112+
94113
impl EventManager {
95114
/// Add an entry to the interest list of the epoll file descriptor.
96115
///

0 commit comments

Comments
 (0)