pub struct Time(_, _);Expand description
Human-readable std::time::Duration.
The input is always assumed to be in seconds.
From input can be:
The lowest unit is second, the highest is year, and week is skipped in favor of 7 days.
Examples
| Input | Output |
|---|---|
| 0 | 0 seconds |
| 1 | 1 second |
| 59 | 59 seconds |
| 3599 | 59 minutes, 59 seconds |
| 86399 | 23 hours, 59 minutes, 59 seconds |
| 604799 | 6 days, 23 hours, 59 minutes, 59 seconds |
| 3234815 | 1 month, 6 days, 23 hours, 59 minutes, 59 seconds |
| 63115200 | 2 years |
Credit
This code is forked from https://docs.rs/humantime, edited to remove sub-second time, change spacing and some words.
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Time
impl Ord for Time
source§impl PartialEq<&str> for Time
impl PartialEq<&str> for Time
source§impl PartialEq<Time> for Time
impl PartialEq<Time> for Time
source§impl PartialEq<Time> for str
impl PartialEq<Time> for str
source§impl PartialEq<Time> for u64
impl PartialEq<Time> for u64
source§impl PartialOrd<Time> for Time
impl PartialOrd<Time> for Time
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Eq for Time
impl StructuralEq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations§
source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere T: Display,
source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more