mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-24 18:07:59 +00:00
Pass the variant fields and tuple lengths into visit_{enum,tuple,tuple_struct}
This commit is contained in:
@@ -454,7 +454,10 @@ impl<Iter> de::Deserializer for Deserializer<Iter>
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum<V>(&mut self, _name: &str, mut visitor: V) -> Result<V::Value, Error>
|
||||
fn visit_enum<V>(&mut self,
|
||||
_name: &str,
|
||||
_variants: &'static [&'static str],
|
||||
mut visitor: V) -> Result<V::Value, Error>
|
||||
where V: de::EnumVisitor,
|
||||
{
|
||||
try!(self.parse_whitespace());
|
||||
@@ -645,7 +648,9 @@ impl<Iter> de::VariantVisitor for Deserializer<Iter>
|
||||
de::Deserialize::deserialize(self)
|
||||
}
|
||||
|
||||
fn visit_seq<V>(&mut self, visitor: V) -> Result<V::Value, Error>
|
||||
fn visit_seq<V>(&mut self,
|
||||
_len: usize,
|
||||
visitor: V) -> Result<V::Value, Error>
|
||||
where V: de::Visitor,
|
||||
{
|
||||
de::Deserializer::visit(self, visitor)
|
||||
|
||||
+10
-3
@@ -692,7 +692,10 @@ impl de::Deserializer for Deserializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum<V>(&mut self, _name: &str, mut visitor: V) -> Result<V::Value, Error>
|
||||
fn visit_enum<V>(&mut self,
|
||||
_name: &str,
|
||||
_variants: &'static [&'static str],
|
||||
mut visitor: V) -> Result<V::Value, Error>
|
||||
where V: de::EnumVisitor,
|
||||
{
|
||||
let value = match self.value.take() {
|
||||
@@ -750,7 +753,9 @@ impl<'a> de::VariantVisitor for VariantDeserializer<'a> {
|
||||
de::Deserialize::deserialize(&mut Deserializer::new(self.val.take().unwrap()))
|
||||
}
|
||||
|
||||
fn visit_seq<V>(&mut self, visitor: V) -> Result<V::Value, Error>
|
||||
fn visit_seq<V>(&mut self,
|
||||
_len: usize,
|
||||
visitor: V) -> Result<V::Value, Error>
|
||||
where V: de::Visitor,
|
||||
{
|
||||
if let Value::Array(fields) = self.val.take().unwrap() {
|
||||
@@ -767,7 +772,9 @@ impl<'a> de::VariantVisitor for VariantDeserializer<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_map<V>(&mut self, _fields: &'static[&'static str], visitor: V) -> Result<V::Value, Error>
|
||||
fn visit_map<V>(&mut self,
|
||||
_fields: &'static[&'static str],
|
||||
visitor: V) -> Result<V::Value, Error>
|
||||
where V: de::Visitor,
|
||||
{
|
||||
if let Value::Object(fields) = self.val.take().unwrap() {
|
||||
|
||||
Reference in New Issue
Block a user