diff options
author | Philipp Matthias Schaefer <philipp.matthias.schaefer@posteo.de> | 2016-09-08 21:14:46 +0200 |
---|---|---|
committer | Philipp Matthias Schaefer <philipp.matthias.schaefer@posteo.de> | 2016-09-08 21:23:52 +0200 |
commit | 584794d79125f65537d993ae8acd1ea9e981ad0a (patch) | |
tree | 9c228615a2f9d011e1c9d29d771295b847b6ee99 | |
parent | da36438f5bef8f885fb3ea9269b73ba85df32a07 (diff) | |
download | nix-584794d79125f65537d993ae8acd1ea9e981ad0a.zip |
Add property readers to EpollEvent
-rw-r--r-- | src/sys/epoll.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index 2cdc6638..51f789a2 100644 --- a/src/sys/epoll.rs +++ b/src/sys/epoll.rs @@ -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] |