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 {
|
impl Deserialize for net::IpAddr {
|
||||||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||||
where D: Deserializer,
|
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 {
|
impl Serialize for net::IpAddr {
|
||||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
||||||
where S: Serializer,
|
where S: Serializer,
|
||||||
{
|
{
|
||||||
match *self {
|
self.to_string().serialize(serializer)
|
||||||
net::IpAddr::V4(ref addr) => addr.serialize(serializer),
|
|
||||||
net::IpAddr::V6(ref addr) => addr.serialize(serializer),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user