pub struct Days(/* private fields */);
Expand description
A duration in calendar days.
This is useful because when using TimeDelta
it is possible that adding TimeDelta::days(1)
doesn’t increment the day value as expected due to it being a fixed number of seconds. This
difference applies only when dealing with DateTime<TimeZone>
data types and in other cases
TimeDelta::days(n)
and Days::new(n)
are equivalent.
Implementations§
Trait Implementations§
Source§impl<Tz: TimeZone> Add<Days> for DateTime<Tz>
impl<Tz: TimeZone> Add<Days> for DateTime<Tz>
Add Days
to NaiveDateTime
.
§Panics
Panics if:
- The resulting date would be out of range.
- The local time at the resulting date does not exist or is ambiguous, for example during a daylight saving time transition.
Strongly consider using DateTime<Tz>::checked_sub_days
to get an Option
instead.
Source§impl Add<Days> for NaiveDate
impl Add<Days> for NaiveDate
Add Days
to NaiveDate
.
§Panics
Panics if the resulting date would be out of range.
Consider using NaiveDate::checked_add_days
to get an Option
instead.
Source§impl Add<Days> for NaiveDateTime
impl Add<Days> for NaiveDateTime
Add Days
to NaiveDateTime
.
§Panics
Panics if the resulting date would be out of range.
Consider using checked_add_days
to get an Option
instead.
Source§impl Ord for Days
impl Ord for Days
Source§impl PartialOrd for Days
impl PartialOrd for Days
Source§impl<Tz: TimeZone> Sub<Days> for DateTime<Tz>
impl<Tz: TimeZone> Sub<Days> for DateTime<Tz>
Subtract Days
from DateTime
.
§Panics
Panics if:
- The resulting date would be out of range.
- The local time at the resulting date does not exist or is ambiguous, for example during a daylight saving time transition.
Strongly consider using DateTime<Tz>::checked_sub_days
to get an Option
instead.
Source§impl Sub<Days> for NaiveDate
impl Sub<Days> for NaiveDate
Subtract Days
from NaiveDate
.
§Panics
Panics if the resulting date would be out of range.
Consider using NaiveDate::checked_sub_days
to get an Option
instead.
Source§impl Sub<Days> for NaiveDateTime
impl Sub<Days> for NaiveDateTime
Subtract Days
from NaiveDateTime
.
§Panics
Panics if the resulting date would be out of range.
Consider using checked_sub_days
to get an Option
instead.
impl Copy for Days
impl Eq for Days
impl StructuralPartialEq for Days
Auto Trait Implementations§
impl Freeze for Days
impl RefUnwindSafe for Days
impl Send for Days
impl Sync for Days
impl Unpin for Days
impl UnwindSafe for Days
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes