Function chrono::naive::serde::ts_microseconds::deserialize
source · pub fn deserialize<'de, D>(d: D) -> Result<NaiveDateTime, D::Error>where
D: Deserializer<'de>,
Expand description
Deserialize a NaiveDateTime
from a microseconds timestamp
Intended for use with serde
s deserialize_with
attribute.
Example:
use chrono::naive::serde::ts_microseconds::deserialize as from_micro_ts;
#[derive(Deserialize)]
struct S {
#[serde(deserialize_with = "from_micro_ts")]
time: NaiveDateTime
}
let my_s: S = serde_json::from_str(r#"{ "time": 1526522699918355 }"#)?;