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