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

arbitrary_precision breaks float deserialisation in untagged enum #1108

Open
LDeakin opened this issue Jan 27, 2024 · 0 comments
Open

arbitrary_precision breaks float deserialisation in untagged enum #1108

LDeakin opened this issue Jan 27, 2024 · 0 comments

Comments

@LDeakin
Copy link

LDeakin commented Jan 27, 2024

Without arbitrary_precision the following runs without error:

#[derive(Debug, PartialEq, serde::Deserialize)]
#[serde(untagged)]
pub enum Num {
    Float(f64),
}

fn main() {
    assert_eq!(serde_json::from_str::<Num>(r#"1.0"#).unwrap(), Num::Float(1f64));
}

With arbitrary_precision, serde_json::from_str::<Num>(r#"1.0"#) fails with Error("data did not match any variant of untagged enum Num", line: 0, column: 0).

This issue is similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant