pub struct HumanDuration;Expand description
A config-friendly std::time::Duration.
Can be specified as either human-readable string, such as "1h" or
"15min", or as an integer interpreted as the number of seconds.
Implementations§
Source§impl HumanDuration
impl HumanDuration
pub fn serialize<S>(x: &Duration, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
pub fn deserialize<'de, D>(deserializer: D) -> Result<Duration, D::Error>where
D: Deserializer<'de>,
Trait Implementations§
Source§impl<'de> DeserializeAs<'de, Duration> for HumanDuration
impl<'de> DeserializeAs<'de, Duration> for HumanDuration
Source§fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>where
D: Deserializer<'de>,
fn deserialize_as<D>(deserializer: D) -> Result<Duration, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer.
Source§impl SerializeAs<Duration> for HumanDuration
impl SerializeAs<Duration> for HumanDuration
Source§fn serialize_as<S>(x: &Duration, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize_as<S>(x: &Duration, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
Serialize this value into the given Serde serializer.
Auto Trait Implementations§
impl Freeze for HumanDuration
impl RefUnwindSafe for HumanDuration
impl Send for HumanDuration
impl Sync for HumanDuration
impl Unpin for HumanDuration
impl UnsafeUnpin for HumanDuration
impl UnwindSafe for HumanDuration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more