Closed guoyucode closed 1 year ago
The default implementation of Serialize
and Deserialize
for chrono::NaiveDataTime
is not working with serde_reflection
but you may use the with-annotations provided by chrono::naive::serde
.
For instance#[serde(with = "ts_microseconds")]
https://docs.rs/chrono/latest/chrono/naive/serde/ts_microseconds/index.html
🐛 Bug
[derive(Serialize, Deserialize, Default)]
pub struct A { pub created_at: chrono::NaiveDateTime, pub xxx: i64, }
let mut tracer = serde_reflection::Tracer::new(serde_reflection::TracerConfig::default()); let mut samples = serde_reflection::Samples::new(); tracer.trace_type::(&mut samples).unwrap(); let registry = tracer.registry().unwrap(); serde_json::to_string_pretty(®istry).unwrap_or_default();
error message alert: on an
Err
value: Custom("Failed to deserialize value: \"premature end of input\"")'