Merge pull request #1072 from LinearZoetrope/wrapping
Add std::num::Wrapping impl
This commit is contained in:
commit
eebf0f8db8
@ -1825,3 +1825,20 @@ where
|
||||
deserializer.deserialize_enum("Result", VARIANTS, ResultVisitor(PhantomData))
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::num::Wrapping;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<'de, T> Deserialize<'de> for Wrapping<T>
|
||||
where
|
||||
T: Deserialize<'de>
|
||||
{
|
||||
fn deserialize<D>(deserializer: D) -> Result<Wrapping<T>, D::Error>
|
||||
where D: Deserializer<'de>
|
||||
{
|
||||
Deserialize::deserialize(deserializer).map(Wrapping)
|
||||
}
|
||||
}
|
||||
|
@ -664,3 +664,19 @@ impl Serialize for OsString {
|
||||
self.as_os_str().serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::num::Wrapping;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Serialize> Serialize for Wrapping<T> {
|
||||
#[inline]
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
self.0.serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user