@@ -20,11 +20,15 @@ use sys::{cvt, fd::FileDesc, syscall};
20
20
21
21
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
22
22
#[ derive( Clone ) ]
23
- pub ( crate ) struct SocketAddr ( ( ) ) ;
23
+ pub struct SocketAddr ( ( ) ) ;
24
24
25
25
impl SocketAddr {
26
26
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
27
- pub ( crate ) fn as_pathname ( & self ) -> Option < & Path > {
27
+ pub fn is_unnamed ( & self ) -> bool {
28
+ false
29
+ }
30
+ #[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
31
+ pub fn as_pathname ( & self ) -> Option < & Path > {
28
32
None
29
33
}
30
34
}
@@ -36,7 +40,7 @@ impl fmt::Debug for SocketAddr {
36
40
}
37
41
38
42
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
39
- pub ( crate ) struct UnixStream ( FileDesc ) ;
43
+ pub struct UnixStream ( FileDesc ) ;
40
44
41
45
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
42
46
impl fmt:: Debug for UnixStream {
@@ -55,7 +59,7 @@ impl fmt::Debug for UnixStream {
55
59
56
60
impl UnixStream {
57
61
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
58
- pub ( crate ) fn connect ( path : & Path ) -> io:: Result < UnixStream > {
62
+ pub fn connect ( path : & Path ) -> io:: Result < UnixStream > {
59
63
if let Some ( s) = path. to_str ( ) {
60
64
cvt ( syscall:: open ( format ! ( "chan:{}" , s) , syscall:: O_CLOEXEC ) )
61
65
. map ( FileDesc :: new)
@@ -69,7 +73,7 @@ impl UnixStream {
69
73
}
70
74
71
75
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
72
- pub ( crate ) fn pair ( ) -> io:: Result < ( UnixStream , UnixStream ) > {
76
+ pub fn pair ( ) -> io:: Result < ( UnixStream , UnixStream ) > {
73
77
let server = cvt ( syscall:: open ( "chan:" , syscall:: O_CREAT | syscall:: O_CLOEXEC ) )
74
78
. map ( FileDesc :: new) ?;
75
79
let client = server. duplicate_path ( b"connect" ) ?;
@@ -78,52 +82,52 @@ impl UnixStream {
78
82
}
79
83
80
84
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
81
- pub ( crate ) fn try_clone ( & self ) -> io:: Result < UnixStream > {
85
+ pub fn try_clone ( & self ) -> io:: Result < UnixStream > {
82
86
self . 0 . duplicate ( ) . map ( UnixStream )
83
87
}
84
88
85
89
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
86
- pub ( crate ) fn local_addr ( & self ) -> io:: Result < SocketAddr > {
90
+ pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
87
91
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::local_addr unimplemented on redox" ) )
88
92
}
89
93
90
94
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
91
- pub ( crate ) fn peer_addr ( & self ) -> io:: Result < SocketAddr > {
95
+ pub fn peer_addr ( & self ) -> io:: Result < SocketAddr > {
92
96
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::peer_addr unimplemented on redox" ) )
93
97
}
94
98
95
99
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
96
- pub ( crate ) fn set_read_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
100
+ pub fn set_read_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
97
101
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_read_timeout unimplemented on redox" ) )
98
102
}
99
103
100
104
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
101
- pub ( crate ) fn set_write_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
105
+ pub fn set_write_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
102
106
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_write_timeout unimplemented on redox" ) )
103
107
}
104
108
105
109
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
106
- pub ( crate ) fn read_timeout ( & self ) -> io:: Result < Option < Duration > > {
110
+ pub fn read_timeout ( & self ) -> io:: Result < Option < Duration > > {
107
111
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::read_timeout unimplemented on redox" ) )
108
112
}
109
113
110
114
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
111
- pub ( crate ) fn write_timeout ( & self ) -> io:: Result < Option < Duration > > {
115
+ pub fn write_timeout ( & self ) -> io:: Result < Option < Duration > > {
112
116
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::write_timeout unimplemented on redox" ) )
113
117
}
114
118
115
119
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
116
- pub ( crate ) fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
120
+ pub fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
117
121
self . 0 . set_nonblocking ( nonblocking)
118
122
}
119
123
120
124
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
121
- pub ( crate ) fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
125
+ pub fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
122
126
Ok ( None )
123
127
}
124
128
125
129
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
126
- pub ( crate ) fn shutdown ( & self , _how : Shutdown ) -> io:: Result < ( ) > {
130
+ pub fn shutdown ( & self , _how : Shutdown ) -> io:: Result < ( ) > {
127
131
Err ( Error :: new ( ErrorKind :: Other , "UnixStream::shutdown unimplemented on redox" ) )
128
132
}
129
133
}
@@ -173,7 +177,7 @@ impl IntoRawFd for UnixStream {
173
177
}
174
178
175
179
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
176
- pub ( crate ) struct UnixListener ( FileDesc ) ;
180
+ pub struct UnixListener ( FileDesc ) ;
177
181
178
182
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
179
183
impl fmt:: Debug for UnixListener {
@@ -189,7 +193,7 @@ impl fmt::Debug for UnixListener {
189
193
190
194
impl UnixListener {
191
195
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
192
- pub ( crate ) fn bind ( path : & Path ) -> io:: Result < UnixListener > {
196
+ pub fn bind ( path : & Path ) -> io:: Result < UnixListener > {
193
197
if let Some ( s) = path. to_str ( ) {
194
198
cvt ( syscall:: open ( format ! ( "chan:{}" , s) , syscall:: O_CREAT | syscall:: O_CLOEXEC ) )
195
199
. map ( FileDesc :: new)
@@ -203,27 +207,27 @@ impl UnixListener {
203
207
}
204
208
205
209
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
206
- pub ( crate ) fn accept ( & self ) -> io:: Result < ( UnixStream , SocketAddr ) > {
210
+ pub fn accept ( & self ) -> io:: Result < ( UnixStream , SocketAddr ) > {
207
211
self . 0 . duplicate_path ( b"listen" ) . map ( |fd| ( UnixStream ( fd) , SocketAddr ( ( ) ) ) )
208
212
}
209
213
210
214
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
211
- pub ( crate ) fn try_clone ( & self ) -> io:: Result < UnixListener > {
215
+ pub fn try_clone ( & self ) -> io:: Result < UnixListener > {
212
216
self . 0 . duplicate ( ) . map ( UnixListener )
213
217
}
214
218
215
219
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
216
- pub ( crate ) fn local_addr ( & self ) -> io:: Result < SocketAddr > {
220
+ pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
217
221
Err ( Error :: new ( ErrorKind :: Other , "UnixListener::local_addr unimplemented on redox" ) )
218
222
}
219
223
220
224
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
221
- pub ( crate ) fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
225
+ pub fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
222
226
self . 0 . set_nonblocking ( nonblocking)
223
227
}
224
228
225
229
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
226
- pub ( crate ) fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
230
+ pub fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
227
231
Ok ( None )
228
232
}
229
233
}
0 commit comments