@@ -296,35 +296,40 @@ impl<'a> Parser<'a> {
296
296
}
297
297
}
298
298
299
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
299
300
impl FromStr for Ipv4Addr {
300
- type Err = ParseError ;
301
- fn from_str ( s : & str ) -> Result < Ipv4Addr , ParseError > {
301
+ type Err = AddrParseError ;
302
+ fn from_str ( s : & str ) -> Result < Ipv4Addr , AddrParseError > {
302
303
match Parser :: new ( s) . read_till_eof ( |p| p. read_ipv4_addr ( ) ) {
303
304
Some ( s) => Ok ( s) ,
304
- None => Err ( ParseError )
305
+ None => Err ( AddrParseError ( ( ) ) )
305
306
}
306
307
}
307
308
}
308
309
310
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
309
311
impl FromStr for Ipv6Addr {
310
- type Err = ParseError ;
311
- fn from_str ( s : & str ) -> Result < Ipv6Addr , ParseError > {
312
+ type Err = AddrParseError ;
313
+ fn from_str ( s : & str ) -> Result < Ipv6Addr , AddrParseError > {
312
314
match Parser :: new ( s) . read_till_eof ( |p| p. read_ipv6_addr ( ) ) {
313
315
Some ( s) => Ok ( s) ,
314
- None => Err ( ParseError )
316
+ None => Err ( AddrParseError ( ( ) ) )
315
317
}
316
318
}
317
319
}
318
320
321
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
319
322
impl FromStr for SocketAddr {
320
- type Err = ParseError ;
321
- fn from_str ( s : & str ) -> Result < SocketAddr , ParseError > {
323
+ type Err = AddrParseError ;
324
+ fn from_str ( s : & str ) -> Result < SocketAddr , AddrParseError > {
322
325
match Parser :: new ( s) . read_till_eof ( |p| p. read_socket_addr ( ) ) {
323
326
Some ( s) => Ok ( s) ,
324
- None => Err ( ParseError ) ,
327
+ None => Err ( AddrParseError ( ( ) ) ) ,
325
328
}
326
329
}
327
330
}
328
331
329
- #[ derive( Debug , Clone , PartialEq , Copy ) ]
330
- pub struct ParseError ;
332
+ /// An error returned when parsing an IP address or a socket address.
333
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
334
+ #[ derive( Debug , Clone , PartialEq ) ]
335
+ pub struct AddrParseError ( ( ) ) ;
0 commit comments