Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants