Function chrono::naive::serde::ts_nanoseconds::deserialize
[−]
[src]
pub fn deserialize<'de, D>(d: D) -> Result<NaiveDateTime, D::Error> where
D: Deserializer<'de>,
Deserialize a DateTime
from a nanoseconds timestamp
Intended for use with serde
s deserialize_with
attribute.
Example:
use chrono::naive::serde::ts_nanoseconds::deserialize as from_nano_ts; #[derive(Deserialize)] struct S { #[serde(deserialize_with = "from_nano_ts")] time: NaiveDateTime } let my_s: S = serde_json::from_str(r#"{ "time": 1526522699918355733 }"#)?;