/rust/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.52.3/src/util/mod.rs
Line | Count | Source |
1 | | cfg_io_driver! { |
2 | | pub(crate) mod bit; |
3 | | } |
4 | | |
5 | | #[cfg(feature = "fs")] |
6 | | pub(crate) mod as_ref; |
7 | | |
8 | | #[cfg(feature = "rt")] |
9 | | pub(crate) mod atomic_cell; |
10 | | |
11 | | #[cfg(feature = "net")] |
12 | | mod blocking_check; |
13 | | #[cfg(feature = "net")] |
14 | | #[allow(unused_imports)] |
15 | | pub(crate) use blocking_check::check_socket_for_blocking; |
16 | | |
17 | | pub(crate) mod metric_atomics; |
18 | | |
19 | | #[cfg(any( |
20 | | // io driver uses `WakeList` directly |
21 | | feature = "net", |
22 | | feature = "process", |
23 | | // `sync` enables `Notify` and `batch_semaphore`, which require `WakeList`. |
24 | | feature = "sync", |
25 | | // `fs` uses `batch_semaphore`, which requires `WakeList`. |
26 | | feature = "fs", |
27 | | // rt and signal use `Notify`, which requires `WakeList`. |
28 | | feature = "rt", |
29 | | feature = "signal", |
30 | | // time driver uses `WakeList` in `Handle::process_at_time`. |
31 | | feature = "time", |
32 | | ))] |
33 | | mod wake_list; |
34 | | #[cfg(any( |
35 | | feature = "net", |
36 | | feature = "process", |
37 | | feature = "sync", |
38 | | feature = "fs", |
39 | | feature = "rt", |
40 | | feature = "signal", |
41 | | feature = "time", |
42 | | ))] |
43 | | pub(crate) use wake_list::WakeList; |
44 | | |
45 | | #[cfg(any( |
46 | | feature = "fs", |
47 | | feature = "net", |
48 | | feature = "process", |
49 | | feature = "rt", |
50 | | feature = "sync", |
51 | | feature = "signal", |
52 | | feature = "time", |
53 | | fuzzing, |
54 | | ))] |
55 | | pub(crate) mod linked_list; |
56 | | |
57 | | cfg_rt! { |
58 | | pub(crate) mod sharded_list; |
59 | | } |
60 | | |
61 | | #[cfg(any(feature = "rt", feature = "macros"))] |
62 | | pub(crate) mod rand; |
63 | | |
64 | | cfg_rt! { |
65 | | mod idle_notified_set; |
66 | | pub(crate) use idle_notified_set::IdleNotifiedSet; |
67 | | |
68 | | pub(crate) use self::rand::RngSeedGenerator; |
69 | | |
70 | | mod wake; |
71 | | pub(crate) use wake::WakerRef; |
72 | | pub(crate) use wake::{waker_ref, Wake}; |
73 | | |
74 | | mod sync_wrapper; |
75 | | pub(crate) use sync_wrapper::SyncWrapper; |
76 | | |
77 | | mod rc_cell; |
78 | | pub(crate) use rc_cell::RcCell; |
79 | | } |
80 | | |
81 | | cfg_rt_multi_thread! { |
82 | | mod try_lock; |
83 | | pub(crate) use try_lock::TryLock; |
84 | | } |
85 | | |
86 | | pub(crate) mod trace; |
87 | | |
88 | | #[cfg(feature = "fs")] |
89 | | pub(crate) mod typeid; |
90 | | |
91 | | pub(crate) mod error; |
92 | | |
93 | | #[cfg(feature = "io-util")] |
94 | | pub(crate) mod memchr; |
95 | | |
96 | | pub(crate) mod markers; |
97 | | |
98 | | pub(crate) mod cacheline; |
99 | | |
100 | | cfg_io_driver_impl! { |
101 | | pub(crate) mod ptr_expose; |
102 | | } |
103 | | |
104 | | use std::{ops::DerefMut, pin::Pin}; |
105 | | |
106 | | /// Copy of [`std::pin::Pin::as_deref_mut`]. |
107 | | // TODO: Remove this once we bump the MSRV to 1.84. |
108 | 0 | pub(crate) fn pin_as_deref_mut<P: DerefMut>(ptr: Pin<&mut Pin<P>>) -> Pin<&mut P::Target> { |
109 | 0 | unsafe { ptr.get_unchecked_mut() }.as_mut() |
110 | 0 | } |