Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

serde_test::Token::UnitVariant should include variant_index #21

Open
survived opened this issue Aug 22, 2022 · 0 comments
Open

serde_test::Token::UnitVariant should include variant_index #21

survived opened this issue Aug 22, 2022 · 0 comments

Comments

@survived
Copy link

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.

@dtolnay dtolnay closed this as completed Jul 9, 2023
@dtolnay dtolnay transferred this issue from serde-rs/serde Aug 10, 2023
@dtolnay dtolnay reopened this Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants