1#[cfg(feature = "tokio")]
4pub use ntex_tokio::{from_tcp_stream, tcp_connect, tcp_connect_in};
5
6#[cfg(all(unix, feature = "tokio"))]
7pub use ntex_tokio::{from_unix_stream, unix_connect, unix_connect_in};
8
9#[cfg(all(feature = "compio", not(feature = "tokio"), not(feature = "neon")))]
10pub use ntex_compio::{from_tcp_stream, tcp_connect, tcp_connect_in};
11
12#[cfg(all(
13 unix,
14 feature = "compio",
15 not(feature = "tokio"),
16 not(feature = "neon")
17))]
18pub use ntex_compio::{from_unix_stream, unix_connect, unix_connect_in};
19
20#[cfg(all(not(feature = "tokio"), not(feature = "compio"), not(feature = "neon")))]
21mod no_rt {
22 use ntex_io::Io;
23
24 pub async fn tcp_connect(_: std::net::SocketAddr) -> std::io::Result<Io> {
26 Err(std::io::Error::new(
27 std::io::ErrorKind::Other,
28 "runtime is not configure",
29 ))
30 }
31
32 pub async fn tcp_connect_in(
34 _: std::net::SocketAddr,
35 _: ntex_bytes::PoolRef,
36 ) -> std::io::Result<Io> {
37 Err(std::io::Error::new(
38 std::io::ErrorKind::Other,
39 "runtime is not configure",
40 ))
41 }
42
43 #[cfg(unix)]
44 pub async fn unix_connect<'a, P>(_: P) -> std::io::Result<Io>
46 where
47 P: AsRef<std::path::Path> + 'a,
48 {
49 Err(std::io::Error::new(
50 std::io::ErrorKind::Other,
51 "runtime is not configure",
52 ))
53 }
54
55 #[cfg(unix)]
56 pub async fn unix_connect_in<'a, P>(_: P, _: ntex_bytes::PoolRef) -> std::io::Result<Io>
58 where
59 P: AsRef<std::path::Path> + 'a,
60 {
61 Err(std::io::Error::new(
62 std::io::ErrorKind::Other,
63 "runtime is not configure",
64 ))
65 }
66
67 pub fn from_tcp_stream(_: std::net::TcpStream) -> std::io::Result<Io> {
69 Err(std::io::Error::new(
70 std::io::ErrorKind::Other,
71 "runtime is not configure",
72 ))
73 }
74
75 #[cfg(unix)]
76 pub fn from_unix_stream(_: std::os::unix::net::UnixStream) -> std::io::Result<Io> {
78 Err(std::io::Error::new(
79 std::io::ErrorKind::Other,
80 "runtime is not configure",
81 ))
82 }
83}
84
85#[cfg(all(not(feature = "tokio"), not(feature = "compio"), not(feature = "neon")))]
86pub use no_rt::*;