@@ -82,6 +82,8 @@ impl Socket {
82
82
/// the socket is made non-inheritable.
83
83
///
84
84
/// [`Socket::new_raw`] can be used if you don't want these flags to be set.
85
+ ///
86
+ #[ doc = man_links ! ( socket( 2 ) ) ]
85
87
pub fn new ( domain : Domain , ty : Type , protocol : Option < Protocol > ) -> io:: Result < Socket > {
86
88
let ty = set_common_type ( ty) ;
87
89
Socket :: new_raw ( domain, ty, protocol) . and_then ( set_common_flags)
@@ -91,6 +93,8 @@ impl Socket {
91
93
///
92
94
/// This function corresponds to `socket(2)` on Unix and `WSASocketW` on
93
95
/// Windows and simply creates a new socket, no other configuration is done.
96
+ ///
97
+ #[ doc = man_links ! ( socket( 2 ) ) ]
94
98
pub fn new_raw ( domain : Domain , ty : Type , protocol : Option < Protocol > ) -> io:: Result < Socket > {
95
99
let protocol = protocol. map ( |p| p. 0 ) . unwrap_or ( 0 ) ;
96
100
sys:: socket ( domain. 0 , ty. 0 , protocol) . map ( |inner| Socket { inner } )
@@ -106,6 +110,8 @@ impl Socket {
106
110
/// # Notes
107
111
///
108
112
/// This function is only available on Unix.
113
+ ///
114
+ #[ doc = man_links ! ( socketpair( 2 ) ) ]
109
115
#[ cfg( all( feature = "all" , unix) ) ]
110
116
pub fn pair (
111
117
domain : Domain ,
@@ -126,6 +132,8 @@ impl Socket {
126
132
/// # Notes
127
133
///
128
134
/// This function is only available on Unix.
135
+ ///
136
+ #[ doc = man_links ! ( socketpair( 2 ) ) ]
129
137
#[ cfg( all( feature = "all" , unix) ) ]
130
138
pub fn pair_raw (
131
139
domain : Domain ,
@@ -141,6 +149,8 @@ impl Socket {
141
149
///
142
150
/// This function directly corresponds to the `bind(2)` function on Windows
143
151
/// and Unix.
152
+ ///
153
+ #[ doc = man_links ! ( bind( 2 ) ) ]
144
154
pub fn bind ( & self , address : & SockAddr ) -> io:: Result < ( ) > {
145
155
sys:: bind ( self . inner , address)
146
156
}
@@ -159,6 +169,8 @@ impl Socket {
159
169
/// non-blocking mode before calling this function), socket option can't be
160
170
/// set *while connecting*. This will cause errors on Windows. Socket
161
171
/// options can be safely set before and after connecting the socket.
172
+ ///
173
+ #[ doc = man_links ! ( connect( 2 ) ) ]
162
174
pub fn connect ( & self , address : & SockAddr ) -> io:: Result < ( ) > {
163
175
sys:: connect ( self . inner , address)
164
176
}
@@ -171,6 +183,8 @@ impl Socket {
171
183
///
172
184
/// An error will be returned if `listen` or `connect` has already been
173
185
/// called on this builder.
186
+ ///
187
+ #[ doc = man_links ! ( listen( 2 ) ) ]
174
188
pub fn listen ( & self , backlog : i32 ) -> io:: Result < ( ) > {
175
189
sys:: listen ( self . inner , backlog)
176
190
}
@@ -182,6 +196,8 @@ impl Socket {
182
196
///
183
197
/// This function sets the same flags as in done for [`Socket::new`],
184
198
/// [`Socket::accept_raw`] can be used if you don't want to set those flags.
199
+ ///
200
+ #[ doc = man_links ! ( accept( 2 ) ) ]
185
201
pub fn accept ( & self ) -> io:: Result < ( Socket , SockAddr ) > {
186
202
// Use `accept4` on platforms that support it.
187
203
#[ cfg( any(
@@ -213,6 +229,8 @@ impl Socket {
213
229
///
214
230
/// This function directly corresponds to the `accept(2)` function on
215
231
/// Windows and Unix.
232
+ ///
233
+ #[ doc = man_links ! ( accept( 2 ) ) ]
216
234
pub fn accept_raw ( & self ) -> io:: Result < ( Socket , SockAddr ) > {
217
235
sys:: accept ( self . inner ) . map ( |( inner, addr) | ( Socket { inner } , addr) )
218
236
}
@@ -225,6 +243,8 @@ impl Socket {
225
243
/// [bound].
226
244
///
227
245
/// [bound]: Socket::bind
246
+ ///
247
+ #[ doc = man_links ! ( getsockname( 2 ) ) ]
228
248
pub fn local_addr ( & self ) -> io:: Result < SockAddr > {
229
249
sys:: getsockname ( self . inner )
230
250
}
@@ -236,6 +256,8 @@ impl Socket {
236
256
/// This returns an error if the socket is not [`connect`ed].
237
257
///
238
258
/// [`connect`ed]: Socket::connect
259
+ ///
260
+ #[ doc = man_links ! ( getpeername( 2 ) ) ]
239
261
pub fn peer_addr ( & self ) -> io:: Result < SockAddr > {
240
262
sys:: getpeername ( self . inner )
241
263
}
@@ -253,6 +275,8 @@ impl Socket {
253
275
/// On Windows this can **not** be used function cannot be used on a
254
276
/// QOS-enabled socket, see
255
277
/// <https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaduplicatesocketw>.
278
+ ///
279
+ #[ doc = man_links ! ( dup( 2 ) ) ] // FIXME: Windows link to WSADuplicateSocketW.
256
280
pub fn try_clone ( & self ) -> io:: Result < Socket > {
257
281
sys:: try_clone ( self . inner ) . map ( |inner| Socket { inner } )
258
282
}
@@ -273,6 +297,8 @@ impl Socket {
273
297
///
274
298
/// This function will cause all pending and future I/O on the specified
275
299
/// portions to return immediately with an appropriate value.
300
+ ///
301
+ #[ doc = man_links ! ( shutdown( 2 ) ) ]
276
302
pub fn shutdown ( & self , how : Shutdown ) -> io:: Result < ( ) > {
277
303
sys:: shutdown ( self . inner , how)
278
304
}
@@ -284,6 +310,8 @@ impl Socket {
284
310
/// This method might fail if the socket is not connected.
285
311
///
286
312
/// [`connect`]: Socket::connect
313
+ ///
314
+ #[ doc = man_links ! ( recv( 2 ) ) ]
287
315
pub fn recv ( & self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
288
316
self . recv_with_flags ( buf, 0 )
289
317
}
@@ -295,6 +323,8 @@ impl Socket {
295
323
///
296
324
/// [`recv`]: Socket::recv
297
325
/// [`out_of_band_inline`]: Socket::out_of_band_inline
326
+ ///
327
+ #[ doc = man_links ! ( recv( 2 ) ) ]
298
328
#[ cfg( feature = "all" ) ]
299
329
pub fn recv_out_of_band ( & self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
300
330
self . recv_with_flags ( buf, sys:: MSG_OOB )
@@ -304,6 +334,8 @@ impl Socket {
304
334
/// the underlying `recv` call.
305
335
///
306
336
/// [`recv`]: Socket::recv
337
+ ///
338
+ #[ doc = man_links ! ( recv( 2 ) ) ]
307
339
pub fn recv_with_flags ( & self , buf : & mut [ u8 ] , flags : sys:: c_int ) -> io:: Result < usize > {
308
340
sys:: recv ( self . inner , buf, flags)
309
341
}
@@ -320,6 +352,8 @@ impl Socket {
320
352
///
321
353
/// [`recv`]: Socket::recv
322
354
/// [`connect`]: Socket::connect
355
+ ///
356
+ #[ doc = man_links ! ( recvmsg( 2 ) ) ] // FIXME: on Windows link to WSARecv.
323
357
#[ cfg( not( target_os = "redox" ) ) ]
324
358
pub fn recv_vectored ( & self , bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < ( usize , RecvFlags ) > {
325
359
self . recv_vectored_with_flags ( bufs, 0 )
@@ -329,6 +363,8 @@ impl Socket {
329
363
/// flags to the underlying `recvmsg`/`WSARecv` call.
330
364
///
331
365
/// [`recv_vectored`]: Socket::recv_vectored
366
+ ///
367
+ #[ doc = man_links ! ( recvmsg( 2 ) ) ] // FIXME: on Windows link to WSARecv.
332
368
#[ cfg( not( target_os = "redox" ) ) ]
333
369
pub fn recv_vectored_with_flags (
334
370
& self ,
@@ -344,12 +380,16 @@ impl Socket {
344
380
///
345
381
/// Successive calls return the same data. This is accomplished by passing
346
382
/// `MSG_PEEK` as a flag to the underlying `recv` system call.
383
+ ///
384
+ #[ doc = man_links ! ( recv( 2 ) ) ]
347
385
pub fn peek ( & self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
348
386
self . recv_with_flags ( buf, sys:: MSG_PEEK )
349
387
}
350
388
351
389
/// Receives data from the socket. On success, returns the number of bytes
352
390
/// read and the address from whence the data came.
391
+ ///
392
+ #[ doc = man_links ! ( recvfrom( 2 ) ) ]
353
393
pub fn recv_from ( & self , buf : & mut [ u8 ] ) -> io:: Result < ( usize , SockAddr ) > {
354
394
self . recv_from_with_flags ( buf, 0 )
355
395
}
@@ -358,6 +398,8 @@ impl Socket {
358
398
/// flags to the underlying `recvfrom` call.
359
399
///
360
400
/// [`recv_from`]: Socket::recv_from
401
+ ///
402
+ #[ doc = man_links ! ( recvfrom( 2 ) ) ]
361
403
pub fn recv_from_with_flags (
362
404
& self ,
363
405
buf : & mut [ u8 ] ,
@@ -371,6 +413,8 @@ impl Socket {
371
413
/// [`recv_from`] this allows passing multiple buffers.
372
414
///
373
415
/// [`recv_from`]: Socket::recv_from
416
+ ///
417
+ #[ doc = man_links ! ( recvmsg( 2 ) ) ] // FIXME: fix Windows link.
374
418
#[ cfg( not( target_os = "redox" ) ) ]
375
419
pub fn recv_from_vectored (
376
420
& self ,
@@ -383,6 +427,8 @@ impl Socket {
383
427
/// arbitrary flags to the underlying `recvmsg`/`WSARecvFrom` call.
384
428
///
385
429
/// [`recv_from_vectored`]: Socket::recv_from_vectored
430
+ ///
431
+ #[ doc = man_links ! ( recvmsg( 2 ) ) ] // FIXME: fix Windows link.
386
432
#[ cfg( not( target_os = "redox" ) ) ]
387
433
pub fn recv_from_vectored_with_flags (
388
434
& self ,
@@ -399,6 +445,8 @@ impl Socket {
399
445
///
400
446
/// On success, returns the number of bytes peeked and the address from
401
447
/// whence the data came.
448
+ ///
449
+ #[ doc = man_links ! ( recv( 2 ) ) ]
402
450
pub fn peek_from ( & self , buf : & mut [ u8 ] ) -> io:: Result < ( usize , SockAddr ) > {
403
451
self . recv_from_with_flags ( buf, sys:: MSG_PEEK )
404
452
}
@@ -409,6 +457,8 @@ impl Socket {
409
457
/// been connected.
410
458
///
411
459
/// On success returns the number of bytes that were sent.
460
+ ///
461
+ #[ doc = man_links ! ( send( 2 ) ) ]
412
462
pub fn send ( & self , buf : & [ u8 ] ) -> io:: Result < usize > {
413
463
self . send_with_flags ( buf, 0 )
414
464
}
@@ -417,11 +467,15 @@ impl Socket {
417
467
/// `send` call.
418
468
///
419
469
/// [`send`]: #method.send
470
+ ///
471
+ #[ doc = man_links ! ( send( 2 ) ) ]
420
472
pub fn send_with_flags ( & self , buf : & [ u8 ] , flags : i32 ) -> io:: Result < usize > {
421
473
sys:: send ( self . inner , buf, flags)
422
474
}
423
475
424
476
/// Send data to the connected peer. Returns the amount of bytes written.
477
+ ///
478
+ #[ doc = man_links ! ( sendmsg( 2 ) ) ] // FIXME: Windows link.
425
479
#[ cfg( not( target_os = "redox" ) ) ]
426
480
pub fn send_vectored ( & self , bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
427
481
self . send_vectored_with_flags ( bufs, 0 )
@@ -431,6 +485,8 @@ impl Socket {
431
485
/// flags to the underlying `sendmsg`/`WSASend` call.
432
486
///
433
487
/// [`send_vectored`]: Socket::send_vectored
488
+ ///
489
+ #[ doc = man_links ! ( sendmsg( 2 ) ) ] // FIXME: Windows link.
434
490
#[ cfg( not( target_os = "redox" ) ) ]
435
491
pub fn send_vectored_with_flags ( & self , bufs : & [ IoSlice < ' _ > ] , flags : i32 ) -> io:: Result < usize > {
436
492
sys:: send_vectored ( self . inner , bufs, flags)
@@ -443,6 +499,8 @@ impl Socket {
443
499
///
444
500
/// [`send`]: #method.send
445
501
/// [`out_of_band_inline`]: #method.out_of_band_inline
502
+ ///
503
+ #[ doc = man_links ! ( send( 2 ) ) ]
446
504
#[ cfg( feature = "all" ) ]
447
505
pub fn send_out_of_band ( & self , buf : & [ u8 ] ) -> io:: Result < usize > {
448
506
self . send_with_flags ( buf, sys:: MSG_OOB )
@@ -452,6 +510,8 @@ impl Socket {
452
510
/// number of bytes written.
453
511
///
454
512
/// This is typically used on UDP or datagram-oriented sockets.
513
+ ///
514
+ #[ doc = man_links ! ( sendto( 2 ) ) ]
455
515
pub fn send_to ( & self , buf : & [ u8 ] , addr : & SockAddr ) -> io:: Result < usize > {
456
516
self . send_to_with_flags ( buf, addr, 0 )
457
517
}
@@ -460,12 +520,16 @@ impl Socket {
460
520
/// to the underlying `sendto` call.
461
521
///
462
522
/// [`send_to`]: Socket::send_to
523
+ ///
524
+ #[ doc = man_links ! ( sendto( 2 ) ) ]
463
525
pub fn send_to_with_flags ( & self , buf : & [ u8 ] , addr : & SockAddr , flags : i32 ) -> io:: Result < usize > {
464
526
sys:: send_to ( self . inner , buf, addr, flags)
465
527
}
466
528
467
529
/// Send data to a peer listening on `addr`. Returns the amount of bytes
468
530
/// written.
531
+ ///
532
+ #[ doc = man_links ! ( sendmsg( 2 ) ) ] // FIXME: windows link.
469
533
#[ cfg( not( target_os = "redox" ) ) ]
470
534
pub fn send_to_vectored ( & self , bufs : & [ IoSlice < ' _ > ] , addr : & SockAddr ) -> io:: Result < usize > {
471
535
self . send_to_vectored_with_flags ( bufs, addr, 0 )
@@ -475,6 +539,8 @@ impl Socket {
475
539
/// arbitrary flags to the underlying `sendmsg`/`WSASendTo` call.
476
540
///
477
541
/// [`send_to_vectored`]: Socket::send_to_vectored
542
+ ///
543
+ #[ doc = man_links ! ( sendmsg( 2 ) ) ] // FIXME: windows link.
478
544
#[ cfg( not( target_os = "redox" ) ) ]
479
545
pub fn send_to_vectored_with_flags (
480
546
& self ,
0 commit comments