1 // Copyright (c) 2023 Huawei Device Co., Ltd.
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 //     http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 #![warn(missing_docs)]
15 
16 //! # ylong_runtime
17 //! A runtime for writing IO-bounded and CPU-bounded applications.
18 
19 #[cfg(all(
20     feature = "ffrt",
21     any(feature = "current_thread_runtime", feature = "multi_instance_runtime")
22 ))]
23 compile_error!("Feature ffrt can not be enabled with feature current_thread_runtime or feature multi_instance_runtime");
24 
25 #[cfg(all(feature = "ffrt", not(target_os = "linux")))]
26 compile_error!("Feature ffrt only works on linux currently");
27 
28 #[cfg(all(feature = "ffrt", feature = "metrics"))]
29 compile_error!("Feature ffrt can not be enabled with feature metrics");
30 
31 extern crate core;
32 
33 #[macro_use]
34 mod macros;
35 
36 pub mod builder;
37 pub mod error;
38 pub mod executor;
39 pub mod fastrand;
40 pub mod futures;
41 pub mod io;
42 pub mod iter;
43 pub mod task;
44 
45 pub use crate::task::{block_on, spawn, spawn_blocking};
46 
47 mod spawn;
48 mod util;
49 
50 cfg_ffrt! {
51     pub(crate) mod ffrt;
52     pub use ylong_ffrt::Qos;
53 }
54 
55 cfg_macros! {
56     mod select;
57     pub use ylong_runtime_macros::tuple_form;
58 }
59 
60 cfg_time! {
61     pub mod time;
62 }
63 
64 cfg_signal! {
65     pub mod signal;
66 }
67 
68 cfg_sync! {
69     pub mod sync;
70 }
71 
72 cfg_metrics! {
73     mod metrics;
74     pub use metrics::Metrics;
75 }
76 
77 cfg_fs! {
78     pub mod fs;
79 }
80 
81 cfg_net! {
82     pub mod net;
83 }
84 
85 #[cfg(target_os = "linux")]
86 cfg_process! {
87     pub mod process;
88 }
89