pub struct HumanTime { /* private fields */ }
Expand description
Duration
wrapper that helps expressing the duration in human languages
Implementations§
Source§impl HumanTime
impl HumanTime
Sourcepub fn now() -> Self
pub fn now() -> Self
Create HumanTime
object that corresponds to the current point in time.
. Similar to chrono::Utc::now()
Sourcepub fn to_text_en(self, accuracy: Accuracy, tense: Tense) -> String
pub fn to_text_en(self, accuracy: Accuracy, tense: Tense) -> String
Gives English text representation of the HumanTime
with given accuracy
and ’tense`
Sourcepub fn from_duration_since_timestamp(timestamp: u64) -> HumanTime
pub fn from_duration_since_timestamp(timestamp: u64) -> HumanTime
Return HumanTime
for given seconds from epoch start
Sourcepub fn to_unix_timestamp(&self) -> i64
pub fn to_unix_timestamp(&self) -> i64
Returns the unix timestamp till Duration
Source§impl HumanTime
Instantiate HumanTime
from different time metrics
impl HumanTime
Instantiate HumanTime
from different time metrics
Sourcepub fn from_seconds(seconds: i64) -> HumanTime
pub fn from_seconds(seconds: i64) -> HumanTime
Instantiate HumanTime
for given seconds
Sourcepub fn from_minutes(minutes: i64) -> HumanTime
pub fn from_minutes(minutes: i64) -> HumanTime
Instantiate HumanTime
for given minutes
Sourcepub fn from_hours(hours: i64) -> HumanTime
pub fn from_hours(hours: i64) -> HumanTime
Instantiate HumanTime
for given hours
Sourcepub fn from_weeks(weeks: i64) -> HumanTime
pub fn from_weeks(weeks: i64) -> HumanTime
Instantiate HumanTime
for given weeks
Sourcepub fn from_months(months: i64) -> HumanTime
pub fn from_months(months: i64) -> HumanTime
Instantiate HumanTime
for given months
Sourcepub fn from_years(years: i64) -> HumanTime
pub fn from_years(years: i64) -> HumanTime
Instantiate HumanTime
for given years
Trait Implementations§
Source§impl From<SystemTime> for HumanTime
impl From<SystemTime> for HumanTime
Source§fn from(st: SystemTime) -> Self
fn from(st: SystemTime) -> Self
Converts to this type from the input type.
Source§impl PartialOrd for HumanTime
impl PartialOrd for HumanTime
impl Copy for HumanTime
impl StructuralPartialEq for HumanTime
Auto Trait Implementations§
impl Freeze for HumanTime
impl RefUnwindSafe for HumanTime
impl Send for HumanTime
impl Sync for HumanTime
impl Unpin for HumanTime
impl UnwindSafe for HumanTime
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