Skip to main content

pal_async/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! An asynchronous IO platform.
5
6#[cfg(test)]
7extern crate self as pal_async;
8
9#[cfg(unix)]
10pub mod fd;
11pub mod interest;
12#[cfg(target_os = "linux")]
13pub mod io_uring;
14pub mod local;
15pub mod pipe;
16pub mod process;
17pub mod socket;
18pub mod timer;
19pub mod wait;
20
21pub mod driver;
22#[cfg(any(test, feature = "tests"))]
23pub mod executor_tests;
24pub mod io_pool;
25pub mod multi_waker;
26mod sparsevec;
27#[cfg_attr(unix, path = "unix/mod.rs")]
28#[cfg_attr(windows, path = "windows/mod.rs")]
29mod sys;
30pub mod task;
31mod waker;
32
33/// Windows-specific async functionality.
34#[cfg(windows)]
35pub mod windows {
36    pub use super::sys::iocp::IocpDriver;
37    pub use super::sys::iocp::IocpPool;
38    pub use super::sys::overlapped;
39    pub use super::sys::pipe;
40    pub use super::sys::tp::TpPool;
41    pub use crate::process::PolledProcess;
42}
43
44/// Unix-specific async functionality.
45#[cfg(unix)]
46pub mod unix {
47    pub use super::sys::pipe;
48    pub use super::sys::wait::FdWait;
49
50    #[cfg(target_os = "linux")]
51    pub use super::sys::epoll::EpollDriver;
52    #[cfg(target_os = "linux")]
53    pub use super::sys::epoll::EpollPool;
54
55    #[cfg(target_os = "macos")]
56    pub use super::sys::kqueue::KqueueDriver;
57    #[cfg(target_os = "macos")]
58    pub use super::sys::kqueue::KqueuePool;
59}
60
61/// The default single-threaded IO driver for the platform.
62pub type DefaultDriver = sys::DefaultDriver;
63/// The default single-threaded task pool for the platform.
64pub type DefaultPool = sys::DefaultPool;
65
66pub use pal_async_test::async_test;