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