1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//! Single-threaded asynchronous runtime infrastructure for ntex.
//!
//! A [`System`] owns the runtime configuration and coordinates one or more
//! [`Arbiter`] execution threads. Each arbiter runs local futures on its own
//! thread, allowing tasks to use types that are not `Send`.
//!
//! Use [`System::build()`] to configure a system, [`spawn()`] to start a local
//! task, and [`spawn_blocking()`] for blocking work.
//!
//! Local [`JoinHandle`]s are neither `Send` nor `Sync`, even for `Send` outputs.
//! They detach on drop by default. Use [`JoinHandle::cancel_on_drop()`] to
//! request cancellation on drop instead.
//!
//! Use [`spawn_sendable()`] to spawn a local future whose `Send` output can be
//! awaited on another thread through a [`SendableJoinHandle`]. Dropping that
//! handle detaches the task by default; use [`SendableJoinHandle::cancel()`] or
//! [`SendableJoinHandle::cancel_on_drop()`] to request cancellation.
//!
//! [`Handle::spawn()`] submits a `Send` future to the handle's runtime and
//! returns a [`RemoteJoinHandle`] for the calling thread. On the runtime's own thread
//! the task is spawned directly. From other threads the future and later its
//! `Send` output share one allocation, which is passed to the runtime thread:
//!
//! ```no_run
//! # async fn example(handle: ntex_rt::Handle) {
//! let task = handle.spawn(async { 42 });
//! assert_eq!(task.await.unwrap(), 42);
//! # }
//! ```
//!
//! Dropping the handle detaches the task, [`RemoteJoinHandle::cancel()`] cancels it.
//! A submitted future is polled and dropped on the runtime thread; shutdown or
//! cancellation before producing a result yields a join error. No task is
//! guaranteed to finish. Rejected submissions are never polled and their
//! futures may be dropped on the submitting thread.
//!
//! Use [`Handle::spawn_detached()`] for fire-and-forget work. Its output need
//! not be `Send` and is discarded on the owner.
//!
//! Remote join handles also remain on their calling thread, even when the
//! submission uses the runtime's local fast path. Both the submitted future
//! and its output must be `Send`:
//!
//! ```compile_fail
//! # fn example(handle: ntex_rt::Handle) {
//! handle.spawn(async { std::rc::Rc::new(42) });
//! # }
//! ```
//!
//! [`LocalWaker`] owns a thread-confined wake handle. It specializes native
//! task wakes on their owner thread and preserves standard waker behavior
//! for other runtimes and wrapped wakers.
//!
//! Runtime backends are selected with Cargo features:
//!
//! - no runtime feature uses the native ntex runtime
//! - `tokio` uses the Tokio-based runtime adapter
//! - `compio` uses the Compio-based runtime adapter
//!
//! The `tokio` and `compio` features are mutually exclusive. The [`rt`] module
//! always exposes the native scheduler, including [`Runtime`] and
//! [`RuntimeBuilder`], independently of which adapter supplies the
//! crate-level spawning functions and [`Handle`].
//!
//! A [`Runner`] supplies the event loop used by [`SystemRunner`] and arbiter
//! threads. Building a system only stores its configuration; execution begins
//! when the returned system runner is driven.
//!
//! Native event-loop integrations implement [`Driver`] and use [`PollResult`]
//! from [`Runtime::poll`] to decide whether to wait, poll again, or stop.
//! Runtime, arbiter, and blocking pool metric types are grouped in [`metrics`].
pub use ;
pub use ;
pub use ;
pub use LocalWaker;
pub use ;
pub use ;
pub use ;
pub use ;
pub use *;
pub use *;
pub use ;
pub type HashMap<K, V> = HashMap;
/// Runs `f` while an earlier panic is pending, the process aborts if `f`
/// panics.
pub
/// Aborts the process on a panic raised while an earlier panic is unwinding
/// or held to be resumed.
pub !