Skip to content

Commit 6061ec3

Browse files
committed
Add extra traits for not_bsds
1 parent 9af1e00 commit 6061ec3

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/unix/notbsd/mod.rs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ s_no_extra_traits!{
230230
not(target_os = "android")),
231231
target_arch = "x86_64"),
232232
repr(packed))]
233-
#[allow(missing_debug_implementations)]
234233
pub struct epoll_event {
235234
pub events: ::uint32_t,
236235
pub u64: ::uint64_t,
@@ -262,6 +261,32 @@ s_no_extra_traits!{
262261

263262
cfg_if! {
264263
if #[cfg(feature = "extra_traits")] {
264+
impl PartialEq for epoll_event {
265+
fn eq(&self, other: &epoll_event) -> bool {
266+
self.events == other.events
267+
&& self.u64 == other.u64
268+
}
269+
}
270+
impl Eq for epoll_event {}
271+
impl ::fmt::Debug for epoll_event {
272+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
273+
let events = self.events;
274+
let u64 = self.u64;
275+
f.debug_struct("epoll_event")
276+
.field("events", &events)
277+
.field("u64", &u64)
278+
.finish()
279+
}
280+
}
281+
impl ::hash::Hash for epoll_event {
282+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
283+
let events = self.events;
284+
let u64 = self.u64;
285+
events.hash(state);
286+
u64.hash(state);
287+
}
288+
}
289+
265290
impl PartialEq for sockaddr_un {
266291
fn eq(&self, other: &sockaddr_un) -> bool {
267292
self.sun_family == other.sun_family
@@ -272,9 +297,7 @@ cfg_if! {
272297
.all(|(a, b)| a == b)
273298
}
274299
}
275-
276300
impl Eq for sockaddr_un {}
277-
278301
impl ::fmt::Debug for sockaddr_un {
279302
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
280303
f.debug_struct("sockaddr_un")
@@ -283,7 +306,6 @@ cfg_if! {
283306
.finish()
284307
}
285308
}
286-
287309
impl ::hash::Hash for sockaddr_un {
288310
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
289311
self.sun_family.hash(state);

0 commit comments

Comments
 (0)