()
| 288 | |
| 289 | impl EpollContext { |
| 290 | pub fn new() -> result::Result<EpollContext, io::Error> { |
| 291 | let epoll_fd = epoll::create(true)?; |
| 292 | // Use 'File' to enforce closing on 'epoll_fd' |
| 293 | // SAFETY: the epoll_fd returned by epoll::create is valid and owned by us. |
| 294 | let epoll_file = unsafe { File::from_raw_fd(epoll_fd) }; |
| 295 | |
| 296 | Ok(EpollContext { epoll_file }) |
| 297 | } |
| 298 | |
| 299 | pub fn add_event<T>(&mut self, fd: &T, token: EpollDispatch) -> result::Result<(), io::Error> |
| 300 | where |