The Poll module 83 Next up is our Registry struct. We will only implement one method, called register, and lastly, we'll implement the Drop trait for it, closing the epoll instance: ch04/a-epoll/src/poll. rs impl Registry { pub fn register(&self, source: &Tcp Stream, token: usize, interests: i32)-> Result<()> { let mut event = ffi::Event { events: interests as u32, epoll_data: token, }; let op = ffi::EPOLL_CTL_ADD; let res = unsafe { ffi::epoll_ctl(self. raw_fd, op, source. as_raw_fd(), &mut event) }; if res < 0 { return Err(io::Error::last_os_error()); } Ok(()) } } The register function takes a &Tcp Stream as a source, a token of type usize, and a bitmask named interests, which is of type i32. Note This is where mio does things differently. The source argument is specific to each platform. Instead of having the implementation of register on Registry, it's handled in a platform-specific way in the source argument it receives. The first thing we do is to create an ffi::Event object. The events field is simply set to the bitmask we received and named interests, and epoll_data is set to the value we passed in the token argument.