xref: /aosp_15_r20/external/crosvm/cros_async/src/sys/linux.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright 2021 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 pub mod async_types;
6 mod error;
7 pub mod event;
8 pub mod executor;
9 pub mod fd_executor;
10 pub mod poll_source;
11 mod timer;
12 #[cfg(feature = "tokio")]
13 pub mod tokio_source;
14 pub mod uring_executor;
15 pub mod uring_source;
16 
17 pub use error::AsyncErrorSys;
18 pub use executor::ExecutorKindSys;
19 pub(crate) use fd_executor::EpollReactor;
20 pub use poll_source::Error as PollSourceError;
21 pub use poll_source::PollSource;
22 pub(crate) use uring_executor::UringReactor;
23 pub use uring_source::UringSource;
24 
25 use crate::Error;
26 
27 impl From<Error> for std::io::Error {
from(e: Error) -> Self28     fn from(e: Error) -> Self {
29         use Error::*;
30         match e {
31             EventAsync(e) => e.into(),
32             Io(e) => e,
33             URingExecutor(e) => e.into(),
34             PollSource(e) => e.into(),
35             Timer(e) => e.into(),
36             TimerAsync(e) => e.into(),
37         }
38     }
39 }
40