Rename ser::Serializer::visit_enum_{unit,seq,map} to visit_{unit,tuple,struct}_variant
This commit is contained in:
parent
351b7039a8
commit
d2fef27721
@ -631,7 +631,7 @@ impl<T, E> Serialize for Result<T, E> where T: Serialize, E: Serialize {
|
||||
}
|
||||
}
|
||||
|
||||
serializer.visit_enum_seq("Result", 0, "Ok", Visitor(Some(value)))
|
||||
serializer.visit_tuple_variant("Result", 0, "Ok", Visitor(Some(value)))
|
||||
}
|
||||
Result::Err(ref value) => {
|
||||
struct Visitor<'a, E: 'a>(Option<&'a E>);
|
||||
@ -652,7 +652,7 @@ impl<T, E> Serialize for Result<T, E> where T: Serialize, E: Serialize {
|
||||
}
|
||||
}
|
||||
|
||||
serializer.visit_enum_seq("Result", 1, "Err", Visitor(Some(value)))
|
||||
serializer.visit_tuple_variant("Result", 1, "Err", Visitor(Some(value)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ pub trait Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_unit(&mut self,
|
||||
fn visit_unit_variant(&mut self,
|
||||
_name: &'static str,
|
||||
_variant_index: usize,
|
||||
_variant: &'static str) -> Result<(), Self::Error> {
|
||||
@ -175,7 +175,7 @@ pub trait Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_seq<V>(&mut self,
|
||||
fn visit_tuple_variant<V>(&mut self,
|
||||
_name: &'static str,
|
||||
_variant_index: usize,
|
||||
variant: &'static str,
|
||||
@ -186,7 +186,7 @@ pub trait Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_seq_elt<T>(&mut self, value: T) -> Result<(), Self::Error>
|
||||
fn visit_tuple_variant_elt<T>(&mut self, value: T) -> Result<(), Self::Error>
|
||||
where T: Serialize
|
||||
{
|
||||
self.visit_tuple_struct_elt(value)
|
||||
@ -209,7 +209,9 @@ pub trait Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_struct_elt<K, V>(&mut self, key: K, value: V) -> Result<(), Self::Error>
|
||||
fn visit_struct_elt<K, V>(&mut self,
|
||||
key: K,
|
||||
value: V) -> Result<(), Self::Error>
|
||||
where K: Serialize,
|
||||
V: Serialize,
|
||||
{
|
||||
@ -217,7 +219,7 @@ pub trait Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_map<V>(&mut self,
|
||||
fn visit_struct_variant<V>(&mut self,
|
||||
_name: &'static str,
|
||||
_variant_index: usize,
|
||||
variant: &'static str,
|
||||
@ -228,7 +230,9 @@ pub trait Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_map_elt<K, V>(&mut self, key: K, value: V) -> Result<(), Self::Error>
|
||||
fn visit_struct_variant_elt<K, V>(&mut self,
|
||||
key: K,
|
||||
value: V) -> Result<(), Self::Error>
|
||||
where K: Serialize,
|
||||
V: Serialize,
|
||||
{
|
||||
|
@ -288,7 +288,7 @@ fn serialize_variant(
|
||||
|
||||
quote_arm!(cx,
|
||||
$pat => {
|
||||
::serde::ser::Serializer::visit_enum_unit(
|
||||
::serde::ser::Serializer::visit_unit_variant(
|
||||
serializer,
|
||||
$type_name,
|
||||
$variant_index,
|
||||
@ -421,7 +421,7 @@ fn serialize_tuple_variant(
|
||||
quote_expr!(cx, {
|
||||
$visitor_struct
|
||||
$visitor_impl
|
||||
serializer.visit_enum_seq($type_name, $variant_index, $variant_name, Visitor {
|
||||
serializer.visit_tuple_variant($type_name, $variant_index, $variant_name, Visitor {
|
||||
value: $value_expr,
|
||||
state: 0,
|
||||
_structure_ty: ::std::marker::PhantomData::<&$structure_ty>,
|
||||
@ -476,7 +476,7 @@ fn serialize_struct_variant(
|
||||
quote_expr!(cx, {
|
||||
$visitor_struct
|
||||
$visitor_impl
|
||||
serializer.visit_enum_map($type_name, $variant_index, $variant_name, Visitor {
|
||||
serializer.visit_struct_variant($type_name, $variant_index, $variant_name, Visitor {
|
||||
value: $value_expr,
|
||||
state: 0,
|
||||
_structure_ty: ::std::marker::PhantomData::<&$structure_ty>,
|
||||
|
@ -159,7 +159,7 @@ impl<W, F> ser::Serializer for Serializer<W, F>
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_unit(&mut self,
|
||||
fn visit_unit_variant(&mut self,
|
||||
_name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str) -> io::Result<()> {
|
||||
@ -209,7 +209,7 @@ impl<W, F> ser::Serializer for Serializer<W, F>
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_seq<V>(&mut self,
|
||||
fn visit_tuple_variant<V>(&mut self,
|
||||
_name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str,
|
||||
@ -257,7 +257,7 @@ impl<W, F> ser::Serializer for Serializer<W, F>
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_map<V>(&mut self,
|
||||
fn visit_struct_variant<V>(&mut self,
|
||||
_name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str,
|
||||
|
@ -459,7 +459,7 @@ impl ser::Serializer for Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_unit(&mut self,
|
||||
fn visit_unit_variant(&mut self,
|
||||
_name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str) -> Result<(), ()> {
|
||||
@ -509,7 +509,7 @@ impl ser::Serializer for Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_seq<V>(&mut self,
|
||||
fn visit_tuple_variant<V>(&mut self,
|
||||
_name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str,
|
||||
@ -572,7 +572,7 @@ impl ser::Serializer for Serializer {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_enum_map<V>(&mut self,
|
||||
fn visit_struct_variant<V>(&mut self,
|
||||
_name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str,
|
||||
|
@ -98,7 +98,7 @@ impl<'a> Serializer for AssertSerializer<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn visit_enum_unit(&mut self,
|
||||
fn visit_unit_variant(&mut self,
|
||||
name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str) -> Result<(), ()> {
|
||||
@ -221,7 +221,7 @@ impl<'a> Serializer for AssertSerializer<'a> {
|
||||
self.visit_sequence(visitor)
|
||||
}
|
||||
|
||||
fn visit_enum_seq<V>(&mut self,
|
||||
fn visit_tuple_variant<V>(&mut self,
|
||||
name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str,
|
||||
@ -268,7 +268,7 @@ impl<'a> Serializer for AssertSerializer<'a> {
|
||||
self.visit_mapping(visitor)
|
||||
}
|
||||
|
||||
fn visit_enum_map<V>(&mut self,
|
||||
fn visit_struct_variant<V>(&mut self,
|
||||
name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str,
|
||||
|
Loading…
Reference in New Issue
Block a user