diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs index 4adfd24a..92f55c77 100644 --- a/serde/src/ser/impls.rs +++ b/serde/src/ser/impls.rs @@ -346,11 +346,21 @@ deref_impl!( Serialize for Arc where T: Serialize); #[cfg(any(feature = "std", feature = "collections"))] deref_impl!(<'a, T: ?Sized> Serialize for Cow<'a, T> where T: Serialize + ToOwned); -#[cfg(feature = "unstable")] -deref_impl!( Serialize for NonZero where T: Serialize + Zeroable); - //////////////////////////////////////////////////////////////////////////////// +#[cfg(feature = "unstable")] +impl Serialize for NonZero +where + T: Serialize + Zeroable + Clone, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.clone().get().serialize(serializer) + } +} + impl Serialize for Cell where T: Serialize + Copy,