Skip to main content

AddDateTimeDiff

Trait AddDateTimeDiff 

Source
pub trait AddDateTimeDiff: DateTimeParts {
    type Output;

    // Required method
    fn add_date_time_diff(
        self,
        date_time_diff: &impl DateTimeDiff,
    ) -> Self::Output;
}
Expand description

A trait for date-time types that can apply a DateTimeDiff.

The Output type depends on the date-time type.

  • chrono::NaiveDateTime: Option<NaiveDateTime>, which is None if the result is out of range.
  • chrono::DateTime<Tz>: LocalResult<DateTime<Tz>>, which is None if the result does not exist in the time zone (for example, in a DST gap) and Ambiguous if it exists twice (for example, in a DST overlap).
  • time::PrimitiveDateTime, time::OffsetDateTime and time::UtcDateTime: Option<_>, which is None if the result is out of range. OffsetDateTime keeps the offset of from.
  • jiff::civil::DateTime and jiff::Zoned: Result<_, jiff::Error>. Zoned resolves a DST gap or overlap with the default rules of Jiff.

Required Associated Types§

Required Methods§

Source

fn add_date_time_diff(self, date_time_diff: &impl DateTimeDiff) -> Self::Output

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AddDateTimeDiff for DateTime

Available on crate feature jiff only.
Source§

type Output = Result<DateTime, Error>

Source§

fn add_date_time_diff(self, date_time_diff: &impl DateTimeDiff) -> Self::Output

Source§

impl AddDateTimeDiff for NaiveDateTime

Available on crate feature chrono only.
Source§

type Output = Option<NaiveDateTime>

Source§

fn add_date_time_diff(self, date_time_diff: &impl DateTimeDiff) -> Self::Output

Source§

impl AddDateTimeDiff for OffsetDateTime

Available on crate feature time only.
Source§

type Output = Option<OffsetDateTime>

Source§

fn add_date_time_diff(self, date_time_diff: &impl DateTimeDiff) -> Self::Output

Source§

impl AddDateTimeDiff for PrimitiveDateTime

Available on crate feature time only.
Source§

impl AddDateTimeDiff for UtcDateTime

Available on crate feature time only.
Source§

type Output = Option<UtcDateTime>

Source§

fn add_date_time_diff(self, date_time_diff: &impl DateTimeDiff) -> Self::Output

Source§

impl AddDateTimeDiff for Zoned

Available on crate feature jiff only.
Source§

type Output = Result<Zoned, Error>

Source§

fn add_date_time_diff(self, date_time_diff: &impl DateTimeDiff) -> Self::Output

Source§

impl<Tz> AddDateTimeDiff for DateTime<Tz>
where Tz: TimeZone, DateTime<Tz>: Ord,

Available on crate feature chrono only.
Source§

type Output = LocalResult<DateTime<Tz>>

Source§

fn add_date_time_diff(self, date_time_diff: &impl DateTimeDiff) -> Self::Output

Implementors§