@@ -20,11 +20,15 @@ use sys::{cvt, fd::FileDesc, syscall};
2020
2121#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
2222#[ derive( Clone ) ]
23- pub ( crate ) struct SocketAddr ( ( ) ) ;
23+ pub struct SocketAddr ( ( ) ) ;
2424
2525impl SocketAddr {
2626 #[ 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 > {
2832 None
2933 }
3034}
@@ -36,7 +40,7 @@ impl fmt::Debug for SocketAddr {
3640}
3741
3842#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
39- pub ( crate ) struct UnixStream ( FileDesc ) ;
43+ pub struct UnixStream ( FileDesc ) ;
4044
4145#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
4246impl fmt:: Debug for UnixStream {
@@ -55,7 +59,7 @@ impl fmt::Debug for UnixStream {
5559
5660impl UnixStream {
5761 #[ 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 > {
5963 if let Some ( s) = path. to_str ( ) {
6064 cvt ( syscall:: open ( format ! ( "chan:{}" , s) , syscall:: O_CLOEXEC ) )
6165 . map ( FileDesc :: new)
@@ -69,7 +73,7 @@ impl UnixStream {
6973 }
7074
7175 #[ 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 ) > {
7377 let server = cvt ( syscall:: open ( "chan:" , syscall:: O_CREAT | syscall:: O_CLOEXEC ) )
7478 . map ( FileDesc :: new) ?;
7579 let client = server. duplicate_path ( b"connect" ) ?;
@@ -78,52 +82,52 @@ impl UnixStream {
7882 }
7983
8084 #[ 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 > {
8286 self . 0 . duplicate ( ) . map ( UnixStream )
8387 }
8488
8589 #[ 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 > {
8791 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::local_addr unimplemented on redox" ) )
8892 }
8993
9094 #[ 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 > {
9296 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::peer_addr unimplemented on redox" ) )
9397 }
9498
9599 #[ 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 < ( ) > {
97101 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_read_timeout unimplemented on redox" ) )
98102 }
99103
100104 #[ 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 < ( ) > {
102106 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_write_timeout unimplemented on redox" ) )
103107 }
104108
105109 #[ 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 > > {
107111 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::read_timeout unimplemented on redox" ) )
108112 }
109113
110114 #[ 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 > > {
112116 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::write_timeout unimplemented on redox" ) )
113117 }
114118
115119 #[ 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 < ( ) > {
117121 self . 0 . set_nonblocking ( nonblocking)
118122 }
119123
120124 #[ 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 > > {
122126 Ok ( None )
123127 }
124128
125129 #[ 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 < ( ) > {
127131 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::shutdown unimplemented on redox" ) )
128132 }
129133}
@@ -173,7 +177,7 @@ impl IntoRawFd for UnixStream {
173177}
174178
175179#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
176- pub ( crate ) struct UnixListener ( FileDesc ) ;
180+ pub struct UnixListener ( FileDesc ) ;
177181
178182#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
179183impl fmt:: Debug for UnixListener {
@@ -189,7 +193,7 @@ impl fmt::Debug for UnixListener {
189193
190194impl UnixListener {
191195 #[ 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 > {
193197 if let Some ( s) = path. to_str ( ) {
194198 cvt ( syscall:: open ( format ! ( "chan:{}" , s) , syscall:: O_CREAT | syscall:: O_CLOEXEC ) )
195199 . map ( FileDesc :: new)
@@ -203,27 +207,27 @@ impl UnixListener {
203207 }
204208
205209 #[ 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 ) > {
207211 self . 0 . duplicate_path ( b"listen" ) . map ( |fd| ( UnixStream ( fd) , SocketAddr ( ( ) ) ) )
208212 }
209213
210214 #[ 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 > {
212216 self . 0 . duplicate ( ) . map ( UnixListener )
213217 }
214218
215219 #[ 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 > {
217221 Err ( Error :: new ( ErrorKind :: Other , "UnixListener::local_addr unimplemented on redox" ) )
218222 }
219223
220224 #[ 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 < ( ) > {
222226 self . 0 . set_nonblocking ( nonblocking)
223227 }
224228
225229 #[ 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 > > {
227231 Ok ( None )
228232 }
229233}
0 commit comments