pub struct Range { /* private fields */ }Expand description
Specify an optionally opened range of time. Times are stored in UTC and expected to be given in UTC time.
Implementations§
Source§impl Range
impl Range
Sourcepub fn pretty_duration(d: &Duration) -> String
pub fn pretty_duration(d: &Duration) -> String
Print the duration in a HH:MM:SS format
Sourcepub fn new(from: DateTime<Utc>, to: Option<DateTime<Utc>>) -> Result<Range>
pub fn new(from: DateTime<Utc>, to: Option<DateTime<Utc>>) -> Result<Range>
Create a new Range with the specified from and to
Sourcepub fn day(day: &DateTime<Local>) -> Result<Range>
pub fn day(day: &DateTime<Local>) -> Result<Range>
Create a new Range representing the day containing the given date/time
Sourcepub fn week(day: &DateTime<Local>) -> Result<Range>
pub fn week(day: &DateTime<Local>) -> Result<Range>
Create a new Range representing the week containing the given date/time
Sourcepub fn current_week() -> Result<Range>
pub fn current_week() -> Result<Range>
Create a Range representing the current week
Sourcepub fn month(day: &DateTime<Local>) -> Result<Range>
pub fn month(day: &DateTime<Local>) -> Result<Range>
Create a new Range representing the month containing the given date/time
Sourcepub fn current_month() -> Result<Range>
pub fn current_month() -> Result<Range>
Create a Range representing the current month
Sourcepub fn last_month() -> Result<Range>
pub fn last_month() -> Result<Range>
Create a Range representing the last month
Sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Return true if the range is open. An open range is a Range that has no end set.
Sourcepub fn intersection(&self, other: &Range) -> Option<Range>
pub fn intersection(&self, other: &Range) -> Option<Range>
Return the intersection with another Range, if any.
Trait Implementations§
impl Copy for Range
impl StructuralPartialEq for Range
Auto Trait Implementations§
impl Freeze for Range
impl RefUnwindSafe for Range
impl Send for Range
impl Sync for Range
impl Unpin for Range
impl UnsafeUnpin for Range
impl UnwindSafe for Range
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