serde-rs/test

`serde_test::Token::UnitVariant` should include `variant_index`

survived opened this issue · 0 comments

Currently I'm not able to assert that my enum is correctly serialized using serde_test.

Note that Serializer::serialize_unit_variant accepts three arguments:

fn serialize_unit_variant(
    self,
    name: &'static str,
    variant_index: u32,
    variant: &'static str,
) -> Result<Self::Ok, Self::Error>;

Only two of them are recorded in Token::UnitVariant:

pub enum Token {
    UnitVariant {
        name: &'static str,
        variant: &'static str,
    },
    // ...
}

I'd expect variant_index field to be recorded, though adding it now would require major version bump.