aral_runtime_noop/net/
mod.rs1use crate::io::{Read, Write};
2use std::{
3 future::Future,
4 io::Result,
5 net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
6};
7
8pub trait ToSocketAddrs {
9 type Iter: Iterator<Item = SocketAddr>;
10
11 fn to_socket_addrs(&self) -> impl Future<Output = Result<Self::Iter>> + Send;
12}
13
14impl ToSocketAddrs for (&str, u16) {
15 type Iter = std::vec::IntoIter<SocketAddr>;
16
17 #[inline]
18 async fn to_socket_addrs(&self) -> Result<std::vec::IntoIter<SocketAddr>> {
19 no_runtime_specified!();
20 }
21}
22
23impl ToSocketAddrs for (IpAddr, u16) {
24 type Iter = std::option::IntoIter<SocketAddr>;
25
26 #[inline]
27 async fn to_socket_addrs(&self) -> Result<std::option::IntoIter<SocketAddr>> {
28 no_runtime_specified!();
29 }
30}
31
32impl ToSocketAddrs for (Ipv4Addr, u16) {
33 type Iter = std::option::IntoIter<SocketAddr>;
34
35 #[inline]
36 async fn to_socket_addrs(&self) -> Result<std::option::IntoIter<SocketAddr>> {
37 no_runtime_specified!();
38 }
39}
40
41impl ToSocketAddrs for (Ipv6Addr, u16) {
42 type Iter = std::option::IntoIter<SocketAddr>;
43
44 #[inline]
45 async fn to_socket_addrs(&self) -> Result<std::option::IntoIter<SocketAddr>> {
46 no_runtime_specified!();
47 }
48}
49
50impl ToSocketAddrs for SocketAddr {
51 type Iter = std::option::IntoIter<SocketAddr>;
52
53 #[inline]
54 async fn to_socket_addrs(&self) -> Result<std::option::IntoIter<SocketAddr>> {
55 no_runtime_specified!();
56 }
57}
58
59impl ToSocketAddrs for str {
60 type Iter = std::vec::IntoIter<SocketAddr>;
61
62 #[inline]
63 async fn to_socket_addrs(&self) -> Result<std::vec::IntoIter<SocketAddr>> {
64 no_runtime_specified!();
65 }
66}
67
68impl ToSocketAddrs for String {
69 type Iter = std::vec::IntoIter<SocketAddr>;
70
71 #[inline]
72 async fn to_socket_addrs(&self) -> Result<std::vec::IntoIter<SocketAddr>> {
73 no_runtime_specified!();
74 }
75}
76
77impl ToSocketAddrs for SocketAddrV4 {
78 type Iter = std::option::IntoIter<SocketAddr>;
79
80 #[inline]
81 async fn to_socket_addrs(&self) -> Result<std::option::IntoIter<SocketAddr>> {
82 no_runtime_specified!();
83 }
84}
85
86impl ToSocketAddrs for SocketAddrV6 {
87 type Iter = std::option::IntoIter<SocketAddr>;
88
89 #[inline]
90 async fn to_socket_addrs(&self) -> Result<std::option::IntoIter<SocketAddr>> {
91 no_runtime_specified!();
92 }
93}
94
95impl<'a> ToSocketAddrs for &'a [SocketAddr] {
96 type Iter = std::iter::Cloned<std::slice::Iter<'a, SocketAddr>>;
97
98 #[inline]
99 async fn to_socket_addrs(&self) -> Result<std::iter::Cloned<std::slice::Iter<'a, SocketAddr>>> {
100 no_runtime_specified!();
101 }
102}
103
104pub struct TcpStream;
105
106impl TcpStream {
107 #[inline]
108 pub async fn connect(_addr: impl crate::net::ToSocketAddrs) -> Result<TcpStream> {
109 no_runtime_specified!();
110 }
111
112 #[inline]
113 pub fn local_addr(&self) -> Result<SocketAddr> {
114 no_runtime_specified!();
115 }
116
117 #[inline]
118 pub fn peer_addr(&self) -> Result<SocketAddr> {
119 no_runtime_specified!();
120 }
121
122 #[inline]
123 pub fn nodelay(&self) -> Result<bool> {
124 no_runtime_specified!();
125 }
126
127 #[inline]
128 pub async fn peek(&self, _buf: &mut [u8]) -> Result<usize> {
129 no_runtime_specified!();
130 }
131
132 #[inline]
133 pub fn set_nodelay(&self, _nodelay: bool) -> Result<()> {
134 no_runtime_specified!();
135 }
136
137 #[inline]
138 pub fn set_ttl(&self, _ttl: u32) -> Result<()> {
139 no_runtime_specified!();
140 }
141
142 #[inline]
143 pub fn ttl(&self) -> Result<u32> {
144 no_runtime_specified!();
145 }
146}
147
148impl Read for TcpStream {
149 #[inline]
150 async fn read(&mut self, _buf: &mut [u8]) -> Result<usize> {
151 no_runtime_specified!();
152 }
153}
154
155impl Write for TcpStream {
156 #[inline]
157 async fn write(&mut self, _buf: &[u8]) -> Result<usize> {
158 no_runtime_specified!();
159 }
160
161 #[inline]
162 async fn flush(&mut self) -> Result<()> {
163 no_runtime_specified!();
164 }
165}
166
167pub struct TcpListener;
168
169impl TcpListener {
170 #[inline]
171 pub async fn accept(&self) -> Result<(TcpStream, SocketAddr)> {
172 no_runtime_specified!();
173 }
174
175 #[inline]
176 pub async fn bind(_addr: impl crate::net::ToSocketAddrs) -> Result<Self> {
177 no_runtime_specified!();
178 }
179
180 #[inline]
181 pub fn local_addr(&self) -> Result<SocketAddr> {
182 no_runtime_specified!();
183 }
184}
185
186pub struct UdpSocket;
187
188impl UdpSocket {
189 #[inline]
190 pub async fn bind(_addr: impl crate::net::ToSocketAddrs) -> Result<UdpSocket> {
191 no_runtime_specified!();
192 }
193
194 #[inline]
195 pub fn broadcast(&self) -> Result<bool> {
196 no_runtime_specified!();
197 }
198
199 #[inline]
200 pub async fn connect(&self, _addr: impl crate::net::ToSocketAddrs) -> Result<()> {
201 no_runtime_specified!();
202 }
203
204 #[inline]
205 pub fn join_multicast_v4(&self, _multiaddr: &Ipv4Addr, _interface: &Ipv4Addr) -> Result<()> {
206 no_runtime_specified!();
207 }
208
209 #[inline]
210 pub fn join_multicast_v6(&self, _multiaddr: &Ipv6Addr, _interface: u32) -> Result<()> {
211 no_runtime_specified!();
212 }
213
214 #[inline]
215 pub fn leave_multicast_v4(&self, _multiaddr: &Ipv4Addr, _interface: &Ipv4Addr) -> Result<()> {
216 no_runtime_specified!();
217 }
218
219 #[inline]
220 pub fn leave_multicast_v6(&self, _multiaddr: &Ipv6Addr, _interface: u32) -> Result<()> {
221 no_runtime_specified!();
222 }
223
224 #[inline]
225 pub fn local_addr(&self) -> Result<SocketAddr> {
226 no_runtime_specified!();
227 }
228
229 #[inline]
230 pub fn multicast_loop_v4(&self) -> Result<bool> {
231 no_runtime_specified!();
232 }
233
234 #[inline]
235 pub fn multicast_loop_v6(&self) -> Result<bool> {
236 no_runtime_specified!();
237 }
238
239 #[inline]
240 pub fn multicast_ttl_v4(&self) -> Result<u32> {
241 no_runtime_specified!();
242 }
243
244 #[inline]
245 pub async fn peek_from(&self, _buf: &mut [u8]) -> Result<(usize, SocketAddr)> {
246 no_runtime_specified!();
247 }
248
249 #[inline]
250 pub fn peer_addr(&self) -> Result<SocketAddr> {
251 no_runtime_specified!();
252 }
253
254 #[inline]
255 pub async fn recv(&self, _buf: &mut [u8]) -> Result<usize> {
256 no_runtime_specified!();
257 }
258
259 #[inline]
260 pub async fn recv_from(&self, _buf: &mut [u8]) -> Result<(usize, SocketAddr)> {
261 no_runtime_specified!();
262 }
263
264 #[inline]
265 pub async fn send(&self, _buf: &[u8]) -> Result<usize> {
266 no_runtime_specified!();
267 }
268
269 #[inline]
270 pub async fn send_to(
271 &self, _buf: &[u8], _target: impl crate::net::ToSocketAddrs,
272 ) -> Result<usize> {
273 no_runtime_specified!();
274 }
275
276 #[inline]
277 pub fn set_broadcast(&self, _on: bool) -> Result<()> {
278 no_runtime_specified!();
279 }
280
281 #[inline]
282 pub fn set_multicast_loop_v4(&self, _on: bool) -> Result<()> {
283 no_runtime_specified!();
284 }
285
286 #[inline]
287 pub fn set_multicast_loop_v6(&self, _on: bool) -> Result<()> {
288 no_runtime_specified!();
289 }
290
291 #[inline]
292 pub fn set_multicast_ttl_v4(&self, _ttl: u32) -> Result<()> {
293 no_runtime_specified!();
294 }
295
296 #[inline]
297 pub fn set_ttl(&self, _ttl: u32) -> Result<()> {
298 no_runtime_specified!();
299 }
300
301 #[inline]
302 pub fn ttl(&self) -> Result<u32> {
303 no_runtime_specified!();
304 }
305}