parent
63ba780fd7
commit
b61fddebb0
1 changed files with 15 additions and 1 deletions
|
@ -15,8 +15,10 @@
|
|||
|
||||
use prelude::v1::*;
|
||||
|
||||
use str::FromStr;
|
||||
use error::Error;
|
||||
use fmt;
|
||||
use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
|
||||
use str::FromStr;
|
||||
|
||||
struct Parser<'a> {
|
||||
// parsing as ASCII, so can use byte array
|
||||
|
@ -339,3 +341,15 @@ impl FromStr for SocketAddr {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct AddrParseError(());
|
||||
|
||||
impl fmt::Display for AddrParseError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.write_str(self.description())
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for AddrParseError {
|
||||
fn description(&self) -> &str {
|
||||
"invalid IP address syntax"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue