Skip to content

Commit 584794d

Browse files
committed
Add property readers to EpollEvent
1 parent da36438 commit 584794d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/sys/epoll.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,17 @@ pub struct EpollEvent {
3838
}
3939

4040
impl EpollEvent {
41-
fn new(events: EpollEventKind, data: u64) -> EpollEvent {
41+
pub fn new(events: EpollEventKind, data: u64) -> EpollEvent {
4242
EpollEvent { event: libc::epoll_event { events: events.bits(), u64: data } }
4343
}
44+
45+
pub fn events(&self) -> EpollEventKind {
46+
EpollEventKind::from_bits(self.event.events).unwrap()
47+
}
48+
49+
pub fn data(&self) -> u64 {
50+
self.event.u64
51+
}
4452
}
4553

4654
#[inline]

0 commit comments

Comments
 (0)