pub struct Days(pub(crate) u64);
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.
Tuple Fields§
§0: u64
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_add_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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)