Pass variant index to visit_enum_simple

This commit is contained in:
Erick Tryzelaar 2015-07-29 14:05:51 -07:00
parent 5dc245d2ce
commit 0348a3914d
6 changed files with 9 additions and 3 deletions

View File

@ -127,9 +127,10 @@ pub trait Serializer {
#[inline] #[inline]
fn visit_enum_simple<T>(&mut self, fn visit_enum_simple<T>(&mut self,
_name: &str, name: &'static str,
_variant: &str, variant_index: usize,
_value: T) -> Result<(), Self::Error> variant: &'static str,
value: T) -> Result<(), Self::Error>
where T: Serialize; where T: Serialize;
fn visit_none(&mut self) -> Result<(), Self::Error>; fn visit_none(&mut self) -> Result<(), Self::Error>;

View File

@ -309,6 +309,7 @@ fn serialize_variant(
::serde::ser::Serializer::visit_enum_simple( ::serde::ser::Serializer::visit_enum_simple(
serializer, serializer,
$type_name, $type_name,
$variant_index,
$variant_name, $variant_name,
__simple_value, __simple_value,
) )

View File

@ -174,6 +174,7 @@ impl<W, F> ser::Serializer for Serializer<W, F>
#[inline] #[inline]
fn visit_enum_simple<T>(&mut self, fn visit_enum_simple<T>(&mut self,
_name: &str, _name: &str,
_variant_index: usize,
variant: &str, variant: &str,
value: T, value: T,
) -> io::Result<()> ) -> io::Result<()>

View File

@ -474,6 +474,7 @@ impl ser::Serializer for Serializer {
#[inline] #[inline]
fn visit_enum_simple<T>(&mut self, fn visit_enum_simple<T>(&mut self,
_name: &str, _name: &str,
_variant_index: usize,
variant: &str, variant: &str,
value: T, value: T,
) -> Result<(), ()> ) -> Result<(), ()>

View File

@ -41,6 +41,7 @@ impl serde::Serializer for BytesSerializer {
fn visit_enum_simple<T>(&mut self, fn visit_enum_simple<T>(&mut self,
_name: &str, _name: &str,
_variant_index: usize,
_variant: &str, _variant: &str,
_value: T) -> Result<(), Error> _value: T) -> Result<(), Error>
{ {

View File

@ -84,6 +84,7 @@ impl<'a> Serializer for AssertSerializer<'a> {
fn visit_enum_simple<T>(&mut self, fn visit_enum_simple<T>(&mut self,
name: &str, name: &str,
_variant_index: usize,
variant: &str, variant: &str,
value: T, value: T,
) -> Result<(), ()> ) -> Result<(), ()>