Struct DeltaSeconds

pub struct DeltaSeconds(/* private field */);

The range of seconds for the possible differences between any two pairs of (timestamp, offset).

All of our span types (except for years and months, since they have variable length even in civil datetimes) are defined in terms of this constant. The way it's defined is a little odd, so let's break it down.

Firstly, a span of seconds should be able to represent at least the complete span supported by Timestamp. Thus, it's based off of UnixSeconds::LEN. That is, a span should be able to represent the value UnixSeconds::MAX - UnixSeconds::MIN.

Secondly, a span should also be able to account for any amount of possible time that a time zone offset might add or subtract to an Timestamp. This also means it can account for any difference between two civil::DateTime values.

Thirdly, we would like our span to be divisible by SECONDS_PER_CIVIL_DAY. This isn't strictly required, but it makes defining boundaries a little smoother. If it weren't divisible, then the lower bounds on some types would need to be adjusted by one.

Note that neither the existence of this constant nor defining our spans based on it impacts the correctness of doing arithmetic on zoned instants. Arithmetic on zoned instants still uses "civil" spans, but the length of time for some units (like a day) might vary. The arithmetic for zoned instants accounts for this explicitly. But it still must obey the limits set here.

Implementations

impl DeltaSeconds

const MIN: i64 = <DeltaSeconds as Bounds>::MIN;
const MAX: i64 = <DeltaSeconds as Bounds>::MAX;
const LEN: i128 = _;
const fn error() -> BoundsError
fn check(n: impl Into<i64>) -> Result<i64, BoundsError>
const fn checkc(n: i64) -> Result<i64, BoundsError>
const fn checked_add(n1: i64, n2: i64) -> Result<i64, BoundsError>
fn checked_mul(n1: i64, n2: i64) -> Result<i64, BoundsError>

Trait Implementations

impl Bounds for DeltaSeconds

const WHAT: &'static str = "seconds";
const MIN: Self::Primitive = _;
const MAX: Self::Primitive = _;
type Primitive = i64;
type Error = BoundsError;
fn error() -> BoundsError

impl Eq for DeltaSeconds

impl PartialEq for DeltaSeconds

fn eq(&self, other: &DeltaSeconds) -> bool

impl StructuralPartialEq for DeltaSeconds

Auto Trait Implementations

impl Freeze for DeltaSeconds

impl RefUnwindSafe for DeltaSeconds

impl Send for DeltaSeconds

impl Sync for DeltaSeconds

impl Unpin for DeltaSeconds

impl UnsafeUnpin for DeltaSeconds

impl UnwindSafe for DeltaSeconds

Blanket Implementations

impl<T> Any for DeltaSeconds where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for DeltaSeconds where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for DeltaSeconds where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for DeltaSeconds

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for DeltaSeconds where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for DeltaSeconds where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for DeltaSeconds where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>