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 socket;
17pub mod timer;
18pub mod wait;
19
20pub mod driver;
21#[cfg(any(test, feature = "tests"))]
22pub mod executor_tests;
23pub mod io_pool;
24pub mod multi_waker;
25mod sparsevec;
26#[cfg_attr(unix, path = "unix/mod.rs")]
27#[cfg_attr(windows, path = "windows/mod.rs")]
28mod sys;
29pub mod task;
30mod waker;
31
32/// Windows-specific async functionality.
33#[cfg(windows)]
34pub mod windows {
35    pub use super::sys::iocp::IocpDriver;
36    pub use super::sys::iocp::IocpPool;
37    pub use super::sys::overlapped;
38    pub use super::sys::pipe;
39    pub use super::sys::tp::TpPool;
40}
41
42/// Unix-specific async functionality.
43#[cfg(unix)]
44pub mod unix {
45    pub use super::sys::pipe;
46    pub use super::sys::wait::FdWait;
47
48    #[cfg(target_os = "linux")]
49    pub use super::sys::epoll::EpollDriver;
50    #[cfg(target_os = "linux")]
51    pub use super::sys::epoll::EpollPool;
52
53    #[cfg(target_os = "macos")]
54    pub use super::sys::kqueue::KqueueDriver;
55    #[cfg(target_os = "macos")]
56    pub use super::sys::kqueue::KqueuePool;
57}
58
59/// The default single-threaded IO driver for the platform.
60pub type DefaultDriver = sys::DefaultDriver;
61/// The default single-threaded task pool for the platform.
62pub type DefaultPool = sys::DefaultPool;
63
64pub use pal_async_test::async_test;