diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index 13c8b5a7..9a036180 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -578,6 +578,8 @@ macro_rules! forwarded_impl { #[cfg(all(feature = "std", de_boxed_c_str))] forwarded_impl!((), Box, CString::into_boxed_c_str); +forwarded_impl!((T), Reverse, Reverse); + //////////////////////////////////////////////////////////////////////////////// struct OptionVisitor { diff --git a/serde/src/lib.rs b/serde/src/lib.rs index 1d953d84..21a8ecd9 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -139,6 +139,7 @@ mod lib { pub use self::core::cell::{Cell, RefCell}; pub use self::core::clone::{self, Clone}; + pub use self::core::cmp::Reverse; pub use self::core::convert::{self, From, Into}; pub use self::core::default::{self, Default}; pub use self::core::fmt::{self, Debug, Display}; diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs index 8b40bda3..a8dd49bf 100644 --- a/serde/src/ser/impls.rs +++ b/serde/src/ser/impls.rs @@ -824,3 +824,16 @@ where self.0.serialize(serializer) } } + +impl Serialize for Reverse + where + T: Serialize, +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.0.serialize(serializer) + } +}