• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #![cfg_attr(doc_cfg, feature(doc_cfg))]
16 
17 //! # ylong_runtime
18 //! A runtime for writing IO-bounded and CPU-bounded applications.
19 
20 #[cfg(all(
21     feature = "ffrt",
22     any(feature = "current_thread_runtime", feature = "multi_instance_runtime")
23 ))]
24 compile_error!("Feature ffrt can not be enabled with feature current_thread_runtime or feature multi_instance_runtime");
25 
26 #[cfg(all(feature = "ffrt", not(target_os = "linux")))]
27 compile_error!("Feature ffrt only works on linux currently");
28 
29 #[cfg(all(feature = "ffrt", feature = "metrics"))]
30 compile_error!("Feature ffrt can not be enabled with feature metrics");
31 
32 extern crate core;
33 
34 #[macro_use]
35 mod macros;
36 
37 pub mod builder;
38 pub mod error;
39 pub mod executor;
40 pub mod fastrand;
41 pub mod futures;
42 pub mod io;
43 pub mod iter;
44 pub mod task;
45 
46 pub use crate::task::{block_on, spawn, spawn_blocking};
47 
48 mod spawn;
49 mod util;
50 
51 cfg_ffrt! {
52     pub(crate) mod ffrt;
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_sync! {
65     pub mod sync;
66 }
67 
68 cfg_metrics! {
69     mod metrics;
70     pub use metrics::Metrics;
71 }
72 
73 cfg_fs! {
74     pub mod fs;
75 }
76 
77 cfg_net! {
78     pub mod net;
79 }
80