Skip to content

Commit

Permalink
Add property readers to EpollEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
fiveop committed Sep 8, 2016
1 parent da36438 commit 584794d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sys/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,17 @@ pub struct EpollEvent {
}

impl EpollEvent {
fn new(events: EpollEventKind, data: u64) -> EpollEvent {
pub fn new(events: EpollEventKind, data: u64) -> EpollEvent {
EpollEvent { event: libc::epoll_event { events: events.bits(), u64: data } }
}

pub fn events(&self) -> EpollEventKind {
EpollEventKind::from_bits(self.event.events).unwrap()
}

pub fn data(&self) -> u64 {
self.event.u64
}
}

#[inline]
Expand Down

0 comments on commit 584794d

Please sign in to comment.