-
So I have a custom FormInto implementation to handle a csv file but when decerialising it completely ignores my serde_as macro, what can I do to fix this? I just get a implementation: #[derive(Deserialize, Serialize, Debug)]
struct OptionalFloat(pub String);
impl From<OptionalFloat> for Option<f64> {
fn from(val: OptionalFloat) -> Self {
println!("{:?}", val); // This does not fire at all
match val.0.trim() {
"Error" | "NA" => None,
s => Some(s.parse::<f64>().unwrap()),
}
}
} section of my struct failing: #[serde_as(as = "FromInto<OptionalFloat>")]
#[serde(rename = "GPU1Clk(MHz)")]
pub gpu1clk_mhz: Option<f64>, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Could you please post a small example which exhibits the problem? Otherwise, I cannot reproduce the issue. Please include a CSV with some failing lines and the struct which contains the |
Beta Was this translation helpful? Give feedback.
-
I'm making a tool to do stuff with FrameViewCSV files Full file using the macro: https://github.com/BuyMyMojo/frame_view_tools/blob/d9f50b6ea60359c5bba42dea48fc4563a342661f/src/main.rs I have got it working now but not with the macro: |
Beta Was this translation helpful? Give feedback.
I'm making a tool to do stuff with FrameViewCSV files
FrameView_WindowsTerminal.exe_2022_08_13T002652_Log.csv
Full file using the macro: https://github.com/BuyMyMojo/frame_view_tools/blob/d9f50b6ea60359c5bba42dea48fc4563a342661f/src/main.rs
I have got it working now but not with the macro:
https://github.com/BuyMyMojo/frame_view_tools/blob/main/src/main.rs