human_readable_time/traits.rs
1/// Used to get the number of seconds which represent a specific object which implements this trait.
2pub trait AsSeconds {
3 /// Get the duration time in seconds
4 fn as_seconds(&self) -> u64;
5}
6
7/// Used to get the number of full minutes which represent a specific object which implements this trait.
8pub trait AsMinutes {
9 /// Get the duration time in full minutes
10 fn as_minutes(&self) -> u64;
11}
12
13/// Used to get the number of full hours which represent a specific object which implements this trait.
14pub trait AsHours {
15 /// Get the duration time in full hours
16 fn as_hours(&self) -> u64;
17}
18
19/// Used to get the number of full days which represent a specific object which implements this trait.
20pub trait AsDays {
21 /// Get the duration time in full hours
22 fn as_days(&self) -> u64;
23}
24
25/// Used to convert an object to a [`chrono::Duration`] representation.
26#[cfg(feature = "chrono")]
27pub trait AsDuration {
28 /// Convert the object to a [`chrono::Duration`] representation.
29 fn as_duration(&self) -> chrono::Duration;
30}