From 764b25bd0785f4918ef1cd2fe08e89ecbbe025d8 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Thu, 13 Aug 2015 08:34:37 -0700 Subject: [PATCH] Have Deserializer::visit_{usize,u8,...,isize,i8,...,f32} call visit_{u64,i64,f64} This cuts down the amount of overloading needed by a format like toml which wants to prevent casting a float to an integer and vice versa. --- serde/src/de/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index 9e894d5d..ae5d04f4 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -108,7 +108,7 @@ pub trait Deserializer { fn visit_usize(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_u64(visitor) } /// This method hints that the `Deserialize` type is expecting an `u8` value. @@ -116,7 +116,7 @@ pub trait Deserializer { fn visit_u8(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_u64(visitor) } /// This method hints that the `Deserialize` type is expecting an `u16` value. @@ -124,7 +124,7 @@ pub trait Deserializer { fn visit_u16(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_u64(visitor) } /// This method hints that the `Deserialize` type is expecting an `u32` value. @@ -132,7 +132,7 @@ pub trait Deserializer { fn visit_u32(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_u64(visitor) } /// This method hints that the `Deserialize` type is expecting an `u64` value. @@ -148,7 +148,7 @@ pub trait Deserializer { fn visit_isize(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_i64(visitor) } /// This method hints that the `Deserialize` type is expecting an `i8` value. @@ -156,7 +156,7 @@ pub trait Deserializer { fn visit_i8(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_i64(visitor) } /// This method hints that the `Deserialize` type is expecting an `i16` value. @@ -164,7 +164,7 @@ pub trait Deserializer { fn visit_i16(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_i64(visitor) } /// This method hints that the `Deserialize` type is expecting an `i32` value. @@ -172,7 +172,7 @@ pub trait Deserializer { fn visit_i32(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_i64(visitor) } /// This method hints that the `Deserialize` type is expecting an `i64` value. @@ -188,7 +188,7 @@ pub trait Deserializer { fn visit_f32(&mut self, visitor: V) -> Result where V: Visitor, { - self.visit(visitor) + self.visit_f64(visitor) } /// This method hints that the `Deserialize` type is expecting a `f64` value.