Merge pull request #568 from tbu-/pr_ipaddr_stable
Allow the use of `IpAddr` implementations on stable
This commit is contained in:
commit
9970084550
@ -809,7 +809,7 @@ map_impl!(
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(all(feature = "unstable", feature = "std"))]
|
||||
#[cfg(feature = "std")]
|
||||
impl Deserialize for net::IpAddr {
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||
where D: Deserializer,
|
||||
|
@ -640,15 +640,12 @@ impl Serialize for Duration {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(all(feature = "std", feature = "unstable"))]
|
||||
#[cfg(feature = "std")]
|
||||
impl Serialize for net::IpAddr {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
||||
where S: Serializer,
|
||||
{
|
||||
match *self {
|
||||
net::IpAddr::V4(ref addr) => addr.serialize(serializer),
|
||||
net::IpAddr::V6(ref addr) => addr.serialize(serializer),
|
||||
}
|
||||
self.to_string().serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user