Skip to content

Commit

Permalink
fix: missing_debug_implementations
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Woollett-Light <[email protected]>
  • Loading branch information
Jonathan Woollett-Light committed Jun 1, 2023
1 parent 9000c31 commit 697cbdf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![warn(missing_debug_implementations)]

use std::collections::HashMap;
use std::os::unix::io::{AsRawFd, RawFd};

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

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

impl std::fmt::Debug for EventManager {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("EventManager")
.field("epfd", &self.epfd)
.field(
"events",
&self
.events
.iter()
.map(|(k, v)| (*k, v as *const _ as usize))
.collect::<HashMap<_, _>>(),
)
.finish()
}
}

impl EventManager {
/// Add an entry to the interest list of the epoll file descriptor.
///
Expand Down

0 comments on commit 697cbdf

Please sign in to comment.