prevent deserializer from tripping up on positive integers

This commit is contained in:
xenofem 2022-04-28 05:25:03 -04:00
parent bda6da33e8
commit fa1917ac17

View file

@ -29,12 +29,16 @@ pub(crate) mod timestamp {
type Value = i64; type Value = i64;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a signed integer") write!(formatter, "an integer")
} }
fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E> { fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E> {
Ok(v) Ok(v)
} }
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E> {
Ok(v as i64)
}
} }
pub(crate) fn deserialize<'de, D: Deserializer<'de>>( pub(crate) fn deserialize<'de, D: Deserializer<'de>>(