NonZero is just another deref

This commit is contained in:
David Tolnay 2017-04-13 16:44:05 -07:00
parent 8b6f77095a
commit 0e7c027ff1
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -331,6 +331,9 @@ deref_impl!(<T> Serialize for Arc<T> where T: Serialize);
#[cfg(any(feature = "std", feature = "collections"))] #[cfg(any(feature = "std", feature = "collections"))]
deref_impl!(<'a, T: ?Sized> Serialize for Cow<'a, T> where T: Serialize + ToOwned); deref_impl!(<'a, T: ?Sized> Serialize for Cow<'a, T> where T: Serialize + ToOwned);
#[cfg(feature = "unstable")]
deref_impl!(<T> Serialize for NonZero<T> where T: Serialize + Zeroable);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
impl<T, E> Serialize for Result<T, E> impl<T, E> Serialize for Result<T, E>
@ -525,16 +528,3 @@ impl Serialize for OsString {
self.as_os_str().serialize(serializer) self.as_os_str().serialize(serializer)
} }
} }
#[cfg(feature = "unstable")]
impl<T> Serialize for NonZero<T>
where
T: Serialize + Zeroable,
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
(**self).serialize(serializer)
}
}