1
- #![ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
1
+ #![ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
2
2
3
3
//! Unix-specific networking functionality
4
4
@@ -27,7 +27,7 @@ use crate::sys::{cvt, fd::FileDesc, syscall};
27
27
/// let addr = socket.local_addr().expect("Couldn't get local address");
28
28
/// ```
29
29
#[ derive( Clone ) ]
30
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
30
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
31
31
pub struct SocketAddr ( ( ) ) ;
32
32
33
33
impl SocketAddr {
@@ -55,7 +55,7 @@ impl SocketAddr {
55
55
/// let addr = socket.local_addr().expect("Couldn't get local address");
56
56
/// assert_eq!(addr.as_pathname(), None);
57
57
/// ```
58
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
58
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
59
59
pub fn as_pathname ( & self ) -> Option < & Path > {
60
60
None
61
61
}
@@ -83,12 +83,12 @@ impl SocketAddr {
83
83
/// let addr = socket.local_addr().expect("Couldn't get local address");
84
84
/// assert_eq!(addr.is_unnamed(), true);
85
85
/// ```
86
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
86
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
87
87
pub fn is_unnamed ( & self ) -> bool {
88
88
false
89
89
}
90
90
}
91
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
91
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
92
92
impl fmt:: Debug for SocketAddr {
93
93
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
94
94
write ! ( fmt, "SocketAddr" )
@@ -109,10 +109,10 @@ impl fmt::Debug for SocketAddr {
109
109
/// stream.read_to_string(&mut response).unwrap();
110
110
/// println!("{}", response);
111
111
/// ```
112
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
112
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
113
113
pub struct UnixStream ( FileDesc ) ;
114
114
115
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
115
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
116
116
impl fmt:: Debug for UnixStream {
117
117
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
118
118
let mut builder = fmt. debug_struct ( "UnixStream" ) ;
@@ -143,7 +143,7 @@ impl UnixStream {
143
143
/// }
144
144
/// };
145
145
/// ```
146
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
146
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
147
147
pub fn connect < P : AsRef < Path > > ( path : P ) -> io:: Result < UnixStream > {
148
148
if let Some ( s) = path. as_ref ( ) . to_str ( ) {
149
149
cvt ( syscall:: open ( format ! ( "chan:{}" , s) , syscall:: O_CLOEXEC ) )
@@ -174,7 +174,7 @@ impl UnixStream {
174
174
/// }
175
175
/// };
176
176
/// ```
177
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
177
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
178
178
pub fn pair ( ) -> io:: Result < ( UnixStream , UnixStream ) > {
179
179
let server = cvt ( syscall:: open ( "chan:" , syscall:: O_CREAT | syscall:: O_CLOEXEC ) )
180
180
. map ( FileDesc :: new) ?;
@@ -198,7 +198,7 @@ impl UnixStream {
198
198
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
199
199
/// let sock_copy = socket.try_clone().expect("Couldn't clone socket");
200
200
/// ```
201
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
201
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
202
202
pub fn try_clone ( & self ) -> io:: Result < UnixStream > {
203
203
self . 0 . duplicate ( ) . map ( UnixStream )
204
204
}
@@ -213,7 +213,7 @@ impl UnixStream {
213
213
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
214
214
/// let addr = socket.local_addr().expect("Couldn't get local address");
215
215
/// ```
216
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
216
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
217
217
pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
218
218
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::local_addr unimplemented on redox" ) )
219
219
}
@@ -228,7 +228,7 @@ impl UnixStream {
228
228
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
229
229
/// let addr = socket.peer_addr().expect("Couldn't get peer address");
230
230
/// ```
231
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
231
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
232
232
pub fn peer_addr ( & self ) -> io:: Result < SocketAddr > {
233
233
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::peer_addr unimplemented on redox" ) )
234
234
}
@@ -267,7 +267,7 @@ impl UnixStream {
267
267
/// let err = result.unwrap_err();
268
268
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
269
269
/// ```
270
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
270
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
271
271
pub fn set_read_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
272
272
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_read_timeout unimplemented on redox" ) )
273
273
}
@@ -306,7 +306,7 @@ impl UnixStream {
306
306
/// let err = result.unwrap_err();
307
307
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
308
308
/// ```
309
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
309
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
310
310
pub fn set_write_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
311
311
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_write_timeout unimplemented on redox" ) )
312
312
}
@@ -323,7 +323,7 @@ impl UnixStream {
323
323
/// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout");
324
324
/// assert_eq!(socket.read_timeout().unwrap(), Some(Duration::new(1, 0)));
325
325
/// ```
326
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
326
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
327
327
pub fn read_timeout ( & self ) -> io:: Result < Option < Duration > > {
328
328
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::read_timeout unimplemented on redox" ) )
329
329
}
@@ -340,7 +340,7 @@ impl UnixStream {
340
340
/// socket.set_write_timeout(Some(Duration::new(1, 0))).expect("Couldn't set write timeout");
341
341
/// assert_eq!(socket.write_timeout().unwrap(), Some(Duration::new(1, 0)));
342
342
/// ```
343
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
343
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
344
344
pub fn write_timeout ( & self ) -> io:: Result < Option < Duration > > {
345
345
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::write_timeout unimplemented on redox" ) )
346
346
}
@@ -355,7 +355,7 @@ impl UnixStream {
355
355
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
356
356
/// socket.set_nonblocking(true).expect("Couldn't set nonblocking");
357
357
/// ```
358
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
358
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
359
359
pub fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
360
360
self . 0 . set_nonblocking ( nonblocking)
361
361
}
@@ -375,7 +375,7 @@ impl UnixStream {
375
375
///
376
376
/// # Platform specific
377
377
/// On Redox this always returns `None`.
378
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
378
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
379
379
pub fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
380
380
Ok ( None )
381
381
}
@@ -397,13 +397,13 @@ impl UnixStream {
397
397
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
398
398
/// socket.shutdown(Shutdown::Both).expect("shutdown function failed");
399
399
/// ```
400
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
400
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
401
401
pub fn shutdown ( & self , _how : Shutdown ) -> io:: Result < ( ) > {
402
402
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::shutdown unimplemented on redox" ) )
403
403
}
404
404
}
405
405
406
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
406
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
407
407
impl io:: Read for UnixStream {
408
408
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
409
409
io:: Read :: read ( & mut & * self , buf)
@@ -415,7 +415,7 @@ impl io::Read for UnixStream {
415
415
}
416
416
}
417
417
418
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
418
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
419
419
impl < ' a > io:: Read for & ' a UnixStream {
420
420
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
421
421
self . 0 . read ( buf)
@@ -427,7 +427,7 @@ impl<'a> io::Read for &'a UnixStream {
427
427
}
428
428
}
429
429
430
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
430
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
431
431
impl io:: Write for UnixStream {
432
432
fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
433
433
io:: Write :: write ( & mut & * self , buf)
@@ -438,7 +438,7 @@ impl io::Write for UnixStream {
438
438
}
439
439
}
440
440
441
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
441
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
442
442
impl < ' a > io:: Write for & ' a UnixStream {
443
443
fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
444
444
self . 0 . write ( buf)
@@ -449,21 +449,21 @@ impl<'a> io::Write for &'a UnixStream {
449
449
}
450
450
}
451
451
452
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
452
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
453
453
impl AsRawFd for UnixStream {
454
454
fn as_raw_fd ( & self ) -> RawFd {
455
455
self . 0 . raw ( )
456
456
}
457
457
}
458
458
459
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
459
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
460
460
impl FromRawFd for UnixStream {
461
461
unsafe fn from_raw_fd ( fd : RawFd ) -> UnixStream {
462
462
UnixStream ( FileDesc :: new ( fd) )
463
463
}
464
464
}
465
465
466
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
466
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
467
467
impl IntoRawFd for UnixStream {
468
468
fn into_raw_fd ( self ) -> RawFd {
469
469
self . 0 . into_raw ( )
@@ -498,10 +498,10 @@ impl IntoRawFd for UnixStream {
498
498
/// }
499
499
/// }
500
500
/// ```
501
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
501
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
502
502
pub struct UnixListener ( FileDesc ) ;
503
503
504
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
504
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
505
505
impl fmt:: Debug for UnixListener {
506
506
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
507
507
let mut builder = fmt. debug_struct ( "UnixListener" ) ;
@@ -529,7 +529,7 @@ impl UnixListener {
529
529
/// }
530
530
/// };
531
531
/// ```
532
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
532
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
533
533
pub fn bind < P : AsRef < Path > > ( path : P ) -> io:: Result < UnixListener > {
534
534
if let Some ( s) = path. as_ref ( ) . to_str ( ) {
535
535
cvt ( syscall:: open ( format ! ( "chan:{}" , s) , syscall:: O_CREAT | syscall:: O_CLOEXEC ) )
@@ -563,7 +563,7 @@ impl UnixListener {
563
563
/// Err(e) => println!("accept function failed: {:?}", e),
564
564
/// }
565
565
/// ```
566
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
566
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
567
567
pub fn accept ( & self ) -> io:: Result < ( UnixStream , SocketAddr ) > {
568
568
self . 0 . duplicate_path ( b"listen" ) . map ( |fd| ( UnixStream ( fd) , SocketAddr ( ( ) ) ) )
569
569
}
@@ -583,7 +583,7 @@ impl UnixListener {
583
583
///
584
584
/// let listener_copy = listener.try_clone().expect("try_clone failed");
585
585
/// ```
586
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
586
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
587
587
pub fn try_clone ( & self ) -> io:: Result < UnixListener > {
588
588
self . 0 . duplicate ( ) . map ( UnixListener )
589
589
}
@@ -599,7 +599,7 @@ impl UnixListener {
599
599
///
600
600
/// let addr = listener.local_addr().expect("Couldn't get local address");
601
601
/// ```
602
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
602
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
603
603
pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
604
604
Err ( Error :: new ( ErrorKind :: Other , "UnixListener::local_addr unimplemented on redox" ) )
605
605
}
@@ -615,7 +615,7 @@ impl UnixListener {
615
615
///
616
616
/// listener.set_nonblocking(true).expect("Couldn't set non blocking");
617
617
/// ```
618
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
618
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
619
619
pub fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
620
620
self . 0 . set_nonblocking ( nonblocking)
621
621
}
@@ -636,7 +636,7 @@ impl UnixListener {
636
636
///
637
637
/// # Platform specific
638
638
/// On Redox this always returns `None`.
639
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
639
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
640
640
pub fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
641
641
Ok ( None )
642
642
}
@@ -672,34 +672,34 @@ impl UnixListener {
672
672
/// }
673
673
/// }
674
674
/// ```
675
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
675
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
676
676
pub fn incoming < ' a > ( & ' a self ) -> Incoming < ' a > {
677
677
Incoming { listener : self }
678
678
}
679
679
}
680
680
681
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
681
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
682
682
impl AsRawFd for UnixListener {
683
683
fn as_raw_fd ( & self ) -> RawFd {
684
684
self . 0 . raw ( )
685
685
}
686
686
}
687
687
688
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
688
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
689
689
impl FromRawFd for UnixListener {
690
690
unsafe fn from_raw_fd ( fd : RawFd ) -> UnixListener {
691
691
UnixListener ( FileDesc :: new ( fd) )
692
692
}
693
693
}
694
694
695
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
695
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
696
696
impl IntoRawFd for UnixListener {
697
697
fn into_raw_fd ( self ) -> RawFd {
698
698
self . 0 . into_raw ( )
699
699
}
700
700
}
701
701
702
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
702
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
703
703
impl < ' a > IntoIterator for & ' a UnixListener {
704
704
type Item = io:: Result < UnixStream > ;
705
705
type IntoIter = Incoming < ' a > ;
@@ -740,12 +740,12 @@ impl<'a> IntoIterator for &'a UnixListener {
740
740
/// }
741
741
/// ```
742
742
#[ derive( Debug ) ]
743
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
743
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
744
744
pub struct Incoming < ' a > {
745
745
listener : & ' a UnixListener ,
746
746
}
747
747
748
- #[ stable( feature = "unix_socket_redox" , since = "1.29" ) ]
748
+ #[ stable( feature = "unix_socket_redox" , since = "1.29.0 " ) ]
749
749
impl < ' a > Iterator for Incoming < ' a > {
750
750
type Item = io:: Result < UnixStream > ;
751
751
0 commit comments