[][src]Enum chrono::RoundingError

pub enum RoundingError {
    DurationExceedsTimestamp,
    DurationExceedsLimit,
    TimestampExceedsLimit,
}

An error from rounding by Duration

See: [DurationRound]

Variants

DurationExceedsTimestamp

Error when the Duration exceeds the Duration from or until the Unix epoch.

let dt = Utc.ymd(1970, 12, 12).and_hms(0, 0, 0);

assert_eq!(
    dt.duration_round(Duration::days(365)),
    Err(RoundingError::DurationExceedsTimestamp),
);
DurationExceedsLimit

Error when Duration.num_nanoseconds exceeds the limit.

let dt = Utc.ymd(2260, 12, 31).and_hms_nano(23, 59, 59, 1_75_500_000);

assert_eq!(
    dt.duration_round(Duration::days(300 * 365)),
    Err(RoundingError::DurationExceedsLimit)
);
TimestampExceedsLimit

Error when DateTime.timestamp_nanos exceeds the limit.

let dt = Utc.ymd(2300, 12, 12).and_hms(0, 0, 0);

assert_eq!(dt.duration_round(Duration::days(1)), Err(RoundingError::TimestampExceedsLimit),);

Trait Implementations

impl Clone for RoundingError[src]

impl Copy for RoundingError[src]

impl Debug for RoundingError[src]

impl Display for RoundingError[src]

impl Eq for RoundingError[src]

impl Error for RoundingError[src]

impl PartialEq<RoundingError> for RoundingError[src]

impl StructuralEq for RoundingError[src]

impl StructuralPartialEq for RoundingError[src]

Auto Trait Implementations

impl RefUnwindSafe for RoundingError

impl Send for RoundingError

impl Sync for RoundingError

impl Unpin for RoundingError

impl UnwindSafe for RoundingError

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.