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]
fn visit_enum_simple<T>(&mut self,
_name: &str,
_variant: &str,
_value: T) -> Result<(), Self::Error>
name: &'static str,
variant_index: usize,
variant: &'static str,
value: T) -> Result<(), Self::Error>
where T: Serialize;
fn visit_none(&mut self) -> Result<(), Self::Error>;

View File

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

View File

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

View File

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

View File

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

View File

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