#[cfg(all(any(target_os = "linux", target_os = "android"), not(zruntime_poll)))]
mod epoll;
#[cfg(all(any(target_os = "linux", target_os = "android"), not(zruntime_poll)))]
pub(super) use epoll::Poller;
#[cfg(all(
any(
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
all(target_vendor = "apple", zruntime_kqueue),
),
not(zruntime_poll),
))]
mod kqueue;
#[cfg(all(
any(
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
all(target_vendor = "apple", zruntime_kqueue),
),
not(zruntime_poll),
))]
pub(super) use kqueue::Poller;
#[cfg(all(target_vendor = "apple", not(any(zruntime_poll, zruntime_kqueue))))]
mod select;
#[cfg(all(target_vendor = "apple", not(any(zruntime_poll, zruntime_kqueue))))]
pub(super) use select::Poller;
#[cfg(any(
target_os = "wasi",
all(
unix,
any(
zruntime_poll,
not(any(
target_os = "linux",
target_os = "android",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
target_vendor = "apple",
)),
),
),
))]
mod generic;
#[cfg(any(
target_os = "wasi",
all(
unix,
any(
zruntime_poll,
not(any(
target_os = "linux",
target_os = "android",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
target_vendor = "apple",
)),
),
),
))]
pub(super) use generic::Poller;
#[cfg(windows)]
mod windows;
#[cfg(windows)]
pub(super) use windows::Poller;
#[cfg(not(any(
all(any(target_os = "linux", target_os = "android"), not(zruntime_poll)),
all(
any(
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
all(target_vendor = "apple", zruntime_kqueue),
),
not(zruntime_poll),
)
)))]
mod list;
#[cfg(unix)]
mod pipe;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub(super) struct Directions {
pub(super) readable: bool,
pub(super) writable: bool,
}
impl Directions {
pub(super) const NONE: Self = Self {
readable: false,
writable: false,
};
pub(super) fn is_empty(self) -> bool {
!self.readable && !self.writable
}
}
pub(super) struct Ready {
pub(super) key: usize,
pub(super) directions: Directions,
pub(super) dropped: Directions,
}
#[cfg(any(unix, target_os = "wasi"))]
pub(super) type RawSource = std::os::fd::RawFd;
#[cfg(windows)]
pub(super) type RawSource = std::os::windows::io::RawSocket;
pub(super) const MAX_TIMEOUT: std::time::Duration =
std::time::Duration::from_millis(i32::MAX as u64);