mio/sys/unix/selector/
stateless_io_source.rsuse std::io;
use std::os::fd::RawFd;
use crate::{Interest, Registry, Token};
pub(crate) struct IoSourceState;
impl IoSourceState {
pub(crate) fn new() -> IoSourceState {
IoSourceState
}
pub(crate) fn do_io<T, F, R>(&self, f: F, io: &T) -> io::Result<R>
where
F: FnOnce(&T) -> io::Result<R>,
{
f(io)
}
pub(crate) fn register(
&mut self,
registry: &Registry,
token: Token,
interests: Interest,
fd: RawFd,
) -> io::Result<()> {
registry.selector().register(fd, token, interests)
}
pub(crate) fn reregister(
&mut self,
registry: &Registry,
token: Token,
interests: Interest,
fd: RawFd,
) -> io::Result<()> {
registry.selector().reregister(fd, token, interests)
}
pub(crate) fn deregister(&mut self, registry: &Registry, fd: RawFd) -> io::Result<()> {
registry.selector().deregister(fd)
}
}