pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>where
T: Deserialize<'de>,
D: Deserializer<'de>,
Expand description
Serde deserialize_with
function to deserialize time values as nanoseconds.
This function can be used with either of the following Serde attributes:
#[serde(with = "serde_nanos")]
#[serde(deserialize_with = "serde_nanos::deserialize")]
use std::time::Duration;
use serde::Deserialize;
#[derive(Deserialize)]
struct Message {
#[serde(with = "serde_nanos")]
expires_in: Duration,
}