We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In trying to deserialize:
#[derive(Debug, Deserialize)] struct NoisePower { value: f32, units: String } #[derive(Debug, Deserialize)] struct ReceiverReport { #[serde(rename = "NoisePower")] noise_power: NoisePower } #[test] fn receiver_noise_report_a() { let xml = r##" <!--<?xml version=”1.0” standalone=”yes”?>--> <ReceiverReport> <NoisePower value="-152.3" units="dBm"/> </ReceiverReport> "##; let report: ReceiverReport = deserialize(xml.as_bytes()).unwrap(); println!("{:#?}", report); }
I get:
'tests::receiver_noise_report_a' panicked at 'called Result::unwrap() on an Err value: invalid type: string "-152.3", expected f32', /checkout/src/libcore/result.rs:906:4
Result::unwrap()
Err
How do I ensure that NoisePower::value is deserialized as f32?
NoisePower::value
f32
The text was updated successfully, but these errors were encountered:
Duplicate of #25
Sorry, something went wrong.
No branches or pull requests
In trying to deserialize:
I get:
How do I ensure that
NoisePower::value
is deserialized asf32
?The text was updated successfully, but these errors were encountered: