1#![deny(clippy::pedantic)]
10#![allow(
11 type_alias_bounds,
12 missing_debug_implementations,
13 clippy::cast_possible_truncation,
14 clippy::missing_errors_doc,
15 clippy::missing_fields_in_debug,
16 clippy::missing_panics_doc,
17 clippy::must_use_candidate,
18 clippy::too_many_lines,
19 clippy::type_complexity
20)]
21#![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))]
23
24#[cfg(not(test))] pub use ntex_macros::{rt_main as main, rt_test as test};
26
27#[cfg(test)]
28pub(crate) use ntex_macros::rt_test_internal as rt_test;
29
30pub use ntex_service::{forward_poll, forward_ready, forward_shutdown};
31
32pub mod client;
33pub mod http;
34pub mod web;
35
36#[cfg(feature = "ws")]
37pub mod ws;
38
39pub use self::service::{
40 IntoService, IntoServiceFactory, Middleware, Pipeline, Service, ServiceCtx,
41 ServiceFactory, cfg::Cfg, cfg::SharedCfg, chain, chain_factory, fn_service,
42};
43
44pub use ntex_util::{channel, task};
45
46pub mod codec {
47 pub use ntex_codec::*;
49}
50
51pub mod connect {
52 pub use ntex_net::connect::*;
54
55 #[cfg(feature = "openssl")]
56 pub mod openssl {
57 pub use ntex_tls::openssl::*;
58 }
59
60 #[cfg(feature = "rustls")]
61 pub mod rustls {
62 pub use ntex_tls::rustls::*;
63 }
64}
65
66pub mod router {
67 pub use ntex_router::*;
69}
70
71pub mod rt {
72 pub use ntex_rt::*;
74
75 pub use ntex_net::*;
76}
77
78pub mod service {
79 pub use ntex_service::*;
80}
81
82pub mod server {
83 pub use ntex_server::net::*;
85
86 pub use ntex_server::{Signal, signal};
87
88 #[cfg(feature = "openssl")]
89 pub use ntex_tls::openssl;
90
91 #[cfg(feature = "rustls")]
92 pub use ntex_tls::rustls;
93}
94
95pub mod time {
96 pub use ntex_util::time::*;
98}
99
100pub mod io {
101 pub use ntex_dispatcher::*;
103 pub use ntex_io::*;
104}
105
106pub mod testing {
107 pub use ntex_io::testing::IoTest;
109}
110
111pub mod tls {
112 pub use ntex_tls::*;
114}
115
116pub mod error {
117 pub use ntex_error::*;
118}
119
120pub mod util {
121 use std::{error::Error, io, rc::Rc};
122
123 pub use ntex_bytes::{Buf, BufMut, ByteString, Bytes, BytesMut};
124 pub use ntex_util::{HashMap, HashSet, future::*, services::*};
125
126 #[doc(hidden)]
127 #[allow(deprecated)]
128 pub use ntex_util::error::*;
129
130 #[doc(hidden)]
131 pub fn enable_test_logging() {
132 #[cfg(not(feature = "no-test-logging"))]
133 if std::env::var("NTEX_NO_TEST_LOG").is_err() {
134 if std::env::var("RUST_LOG").is_err() {
135 unsafe {
136 std::env::set_var("RUST_LOG", "trace");
137 }
138 }
139 let _ = env_logger::builder().is_test(true).try_init();
140 }
141 }
142
143 pub fn dyn_rc_error<T: Error + 'static>(err: T) -> Rc<dyn Error> {
144 Rc::new(err)
145 }
146
147 pub fn str_rc_error(s: String) -> Rc<dyn Error> {
148 #[derive(thiserror::Error, Debug)]
149 #[error("{_0}")]
150 struct StringError(String);
151
152 Rc::new(StringError(s))
153 }
154
155 pub fn clone_io_error(err: &io::Error) -> io::Error {
156 io::Error::new(err.kind(), format!("{err:?}"))
157 }
158}