@@ -94,12 +94,6 @@ impl fmt::Debug for UnixStream {
9494 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
9595 let mut builder = fmt. debug_struct ( "UnixStream" ) ;
9696 builder. field ( "fd" , & self . 0 . raw ( ) ) ;
97- if let Ok ( addr) = self . local_addr ( ) {
98- builder. field ( "local" , & addr) ;
99- }
100- if let Ok ( addr) = self . peer_addr ( ) {
101- builder. field ( "peer" , & addr) ;
102- }
10397 builder. finish ( )
10498 }
10599}
@@ -177,142 +171,6 @@ impl UnixStream {
177171 self . 0 . duplicate ( ) . map ( UnixStream )
178172 }
179173
180- /// Returns the socket address of the local half of this connection.
181- ///
182- /// # Examples
183- ///
184- /// ```no_run
185- /// use std::os::unix::net::UnixStream;
186- ///
187- /// let socket = UnixStream::connect("/tmp/sock").unwrap();
188- /// let addr = socket.local_addr().expect("Couldn't get local address");
189- /// ```
190- pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
191- Err ( Error :: new ( ErrorKind :: Other , "UnixStream::local_addr unimplemented on redox" ) )
192- }
193-
194- /// Returns the socket address of the remote half of this connection.
195- ///
196- /// # Examples
197- ///
198- /// ```no_run
199- /// use std::os::unix::net::UnixStream;
200- ///
201- /// let socket = UnixStream::connect("/tmp/sock").unwrap();
202- /// let addr = socket.peer_addr().expect("Couldn't get peer address");
203- /// ```
204- pub fn peer_addr ( & self ) -> io:: Result < SocketAddr > {
205- Err ( Error :: new ( ErrorKind :: Other , "UnixStream::peer_addr unimplemented on redox" ) )
206- }
207-
208- /// Sets the read timeout for the socket.
209- ///
210- /// If the provided value is [`None`], then [`read`] calls will block
211- /// indefinitely. An [`Err`] is returned if the zero [`Duration`] is passed to this
212- /// method.
213- ///
214- /// [`None`]: ../../../../std/option/enum.Option.html#variant.None
215- /// [`Err`]: ../../../../std/result/enum.Result.html#variant.Err
216- /// [`read`]: ../../../../std/io/trait.Read.html#tymethod.read
217- /// [`Duration`]: ../../../../std/time/struct.Duration.html
218- ///
219- /// # Examples
220- ///
221- /// ```no_run
222- /// use std::os::unix::net::UnixStream;
223- /// use std::time::Duration;
224- ///
225- /// let socket = UnixStream::connect("/tmp/sock").unwrap();
226- /// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout");
227- /// ```
228- ///
229- /// An [`Err`] is returned if the zero [`Duration`] is passed to this
230- /// method:
231- ///
232- /// ```no_run
233- /// use std::io;
234- /// use std::os::unix::net::UnixStream;
235- /// use std::time::Duration;
236- ///
237- /// let socket = UnixStream::connect("/tmp/sock").unwrap();
238- /// let result = socket.set_read_timeout(Some(Duration::new(0, 0)));
239- /// let err = result.unwrap_err();
240- /// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
241- /// ```
242- pub fn set_read_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
243- Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_read_timeout unimplemented on redox" ) )
244- }
245-
246- /// Sets the write timeout for the socket.
247- ///
248- /// If the provided value is [`None`], then [`write`] calls will block
249- /// indefinitely. An [`Err`] is returned if the zero [`Duration`] is
250- /// passed to this method.
251- ///
252- /// [`None`]: ../../../../std/option/enum.Option.html#variant.None
253- /// [`Err`]: ../../../../std/result/enum.Result.html#variant.Err
254- /// [`write`]: ../../../../std/io/trait.Write.html#tymethod.write
255- /// [`Duration`]: ../../../../std/time/struct.Duration.html
256- ///
257- /// # Examples
258- ///
259- /// ```no_run
260- /// use std::os::unix::net::UnixStream;
261- /// use std::time::Duration;
262- ///
263- /// let socket = UnixStream::connect("/tmp/sock").unwrap();
264- /// socket.set_write_timeout(Some(Duration::new(1, 0))).expect("Couldn't set write timeout");
265- /// ```
266- ///
267- /// An [`Err`] is returned if the zero [`Duration`] is passed to this
268- /// method:
269- ///
270- /// ```no_run
271- /// use std::io;
272- /// use std::net::UdpSocket;
273- /// use std::time::Duration;
274- ///
275- /// let socket = UdpSocket::bind("127.0.0.1:34254").unwrap();
276- /// let result = socket.set_write_timeout(Some(Duration::new(0, 0)));
277- /// let err = result.unwrap_err();
278- /// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
279- /// ```
280- pub fn set_write_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
281- Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_write_timeout unimplemented on redox" ) )
282- }
283-
284- /// Returns the read timeout of this socket.
285- ///
286- /// # Examples
287- ///
288- /// ```no_run
289- /// use std::os::unix::net::UnixStream;
290- /// use std::time::Duration;
291- ///
292- /// let socket = UnixStream::connect("/tmp/sock").unwrap();
293- /// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout");
294- /// assert_eq!(socket.read_timeout().unwrap(), Some(Duration::new(1, 0)));
295- /// ```
296- pub fn read_timeout ( & self ) -> io:: Result < Option < Duration > > {
297- Err ( Error :: new ( ErrorKind :: Other , "UnixStream::read_timeout unimplemented on redox" ) )
298- }
299-
300- /// Returns the write timeout of this socket.
301- ///
302- /// # Examples
303- ///
304- /// ```no_run
305- /// use std::os::unix::net::UnixStream;
306- /// use std::time::Duration;
307- ///
308- /// let socket = UnixStream::connect("/tmp/sock").unwrap();
309- /// socket.set_write_timeout(Some(Duration::new(1, 0))).expect("Couldn't set write timeout");
310- /// assert_eq!(socket.write_timeout().unwrap(), Some(Duration::new(1, 0)));
311- /// ```
312- pub fn write_timeout ( & self ) -> io:: Result < Option < Duration > > {
313- Err ( Error :: new ( ErrorKind :: Other , "UnixStream::write_timeout unimplemented on redox" ) )
314- }
315-
316174 /// Moves the socket into or out of nonblocking mode.
317175 ///
318176 /// # Examples
@@ -342,27 +200,6 @@ impl UnixStream {
342200 pub fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
343201 Ok ( None )
344202 }
345-
346- /// Shuts down the read, write, or both halves of this connection.
347- ///
348- /// This function will cause all pending and future I/O calls on the
349- /// specified portions to immediately return with an appropriate value
350- /// (see the documentation of [`Shutdown`]).
351- ///
352- /// [`Shutdown`]: ../../../../std/net/enum.Shutdown.html
353- ///
354- /// # Examples
355- ///
356- /// ```no_run
357- /// use std::os::unix::net::UnixStream;
358- /// use std::net::Shutdown;
359- ///
360- /// let socket = UnixStream::connect("/tmp/sock").unwrap();
361- /// socket.shutdown(Shutdown::Both).expect("shutdown function failed");
362- /// ```
363- pub fn shutdown ( & self , _how : Shutdown ) -> io:: Result < ( ) > {
364- Err ( Error :: new ( ErrorKind :: Other , "UnixStream::shutdown unimplemented on redox" ) )
365- }
366203}
367204
368205impl io:: Read for UnixStream {
@@ -459,9 +296,6 @@ impl fmt::Debug for UnixListener {
459296 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
460297 let mut builder = fmt. debug_struct ( "UnixListener" ) ;
461298 builder. field ( "fd" , & self . 0 . raw ( ) ) ;
462- if let Ok ( addr) = self . local_addr ( ) {
463- builder. field ( "local" , & addr) ;
464- }
465299 builder. finish ( )
466300 }
467301}
@@ -538,21 +372,6 @@ impl UnixListener {
538372 self . 0 . duplicate ( ) . map ( UnixListener )
539373 }
540374
541- /// Returns the local socket address of this listener.
542- ///
543- /// # Examples
544- ///
545- /// ```no_run
546- /// use std::os::unix::net::UnixListener;
547- ///
548- /// let listener = UnixListener::bind("/path/to/the/socket").unwrap();
549- ///
550- /// let addr = listener.local_addr().expect("Couldn't get local address");
551- /// ```
552- pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
553- Err ( Error :: new ( ErrorKind :: Other , "UnixListener::local_addr unimplemented on redox" ) )
554- }
555-
556375 /// Moves the socket into or out of nonblocking mode.
557376 ///
558377 /// # Examples
0 commit comments