Open sinyo-matu opened 2 years ago
Hi there,
I had the same problem. It turned out that I was missing #[serde(default)]
as well as DataType::Float(f)
.
Applying it to your code makes your test pass.
#[derive(Serialize, Deserialize, Debug)]
struct InputRowRaw {
#[serde(rename(deserialize = "other_name"))]
#[serde(deserialize_with = "de_opt_native_datetime")]
#[serde(default)]
purchase_time: Option<NaiveDateTime>,
}
DataType::Float(f) | DataType::DateTime(f) => Ok(DataType::DateTime(f).as_datetime()),
References:
#[serde(default)]
is required because when using deserialize_with
Am I doing some wrong?
this not works
you can check it at calamine-test