From 584794d79125f65537d993ae8acd1ea9e981ad0a Mon Sep 17 00:00:00 2001 From: Philipp Matthias Schaefer Date: Thu, 8 Sep 2016 21:14:46 +0200 Subject: [PATCH] Add property readers to EpollEvent --- src/sys/epoll.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index 2cdc663859..51f789a243 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]