Struct below_common::dateutil::HgTime
source · [−]Expand description
A simple time structure that matches hg’s time representation.
Internally it’s unixtime (in GMT), and offset (GMT -1 = +3600).
Fields
unixtime: u64offset: i32Implementations
sourceimpl HgTime
impl HgTime
pub fn now() -> Self
sourcepub fn parse(date: &str) -> Option<Self>
pub fn parse(date: &str) -> Option<Self>
Parse a date string.
Return None if it cannot be parsed.
This function matches mercurial.util.parsedate, and can parse
some additional forms like 2 days ago.
It can also handle future forms like “ten hours from now” and “+10h”
sourcepub fn parse_range(date: &str) -> Option<Range<Self>>
pub fn parse_range(date: &str) -> Option<Range<Self>>
Parse a date string as a range.
For example, Apr 2000 covers range Apr 1, 2000 to Apr 30, 2000.
Also support more explicit ranges:
- START to END
-
START
- < END
pub fn parse_time_of_day(date: &str) -> Option<NaiveTime>
pub fn time_of_day_relative_to_system_time(
system_time: SystemTime,
time_of_day: NaiveTime
) -> Option<SystemTime>
pub fn min_value() -> Self
pub fn max_value() -> Self
Trait Implementations
sourceimpl From<NaiveDateTime> for HgTime
impl From<NaiveDateTime> for HgTime
sourcefn from(time: NaiveDateTime) -> Self
fn from(time: NaiveDateTime) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<HgTime> for HgTime
impl PartialEq<HgTime> for HgTime
sourceimpl PartialOrd<HgTime> for HgTime
impl PartialOrd<HgTime> for HgTime
sourcefn partial_cmp(&self, other: &HgTime) -> Option<Ordering>
fn partial_cmp(&self, other: &HgTime) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn 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 more
impl Copy for HgTime
impl StructuralPartialEq for HgTime
Auto Trait Implementations
impl RefUnwindSafe for HgTime
impl Send for HgTime
impl Sync for HgTime
impl Unpin for HgTime
impl UnwindSafe for HgTime
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more