Enum chrono::RoundingError [−][src]
pub enum RoundingError {
DurationExceedsTimestamp,
DurationExceedsLimit,
TimestampExceedsLimit,
}
Expand description
An error from rounding by Duration
See: DurationRound
Variants
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),
);
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)
);
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
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
Mutably borrows from an owned value. Read more