pub enum Temporal {
Date(NaiveDate),
CivilDate {
year: i64,
month: u32,
day: u32,
},
LocalTime(NaiveTime),
Time {
time: NaiveTime,
offset: i32,
},
LocalDateTime(NaiveDateTime),
CivilDateTime {
year: i64,
month: u32,
day: u32,
time: NaiveTime,
},
DateTime {
utc: NaiveDateTime,
offset: i32,
zone: Option<String>,
},
Duration {
months: i64,
days: i64,
nanos: i128,
},
}Variants§
Date(NaiveDate)
CivilDate
Out-of-range proleptic date (TCK ±999999999).
LocalTime(NaiveTime)
Time
LocalDateTime(NaiveDateTime)
CivilDateTime
DateTime
Duration
Implementations§
Source§impl Temporal
impl Temporal
pub fn kind_name(&self) -> &'static str
Sourcepub fn has_date(&self) -> bool
pub fn has_date(&self) -> bool
Whether the value carries a calendar date — the one statement of the
capability partition, beside the type. The field policy
(field_rules::check_sources), the truncation granularity rule and
the part readers all read it, so no consumer keeps its own variant
list.
Sourcepub fn has_time(&self) -> bool
pub fn has_time(&self) -> bool
Whether the value carries a time of day (see Temporal::has_date).
Sourcepub fn has_date_and_time(&self) -> bool
pub fn has_date_and_time(&self) -> bool
Whether the value carries both halves (the datetime source field).
pub fn iso_string(&self) -> String
Sourcepub fn full_seconds_string(&self) -> String
pub fn full_seconds_string(&self) -> String
The full-precision ISO rendering: Temporal::iso_string with
the time-of-day’s seconds always present. The value layer’s
temporal rendering policy for every string-producing surface —
toString (top-level, nested in a map or accepted list, or
through toStringOrNull) and the interpolated-string scalar
path — one rendering for one value, however it was built or
wherever it is embedded (ADR-0448).
Sourcepub fn component(&self, key: &str) -> Result<Value, Error>
pub fn component(&self, key: &str) -> Result<Value, Error>
One component accessor (d.year, t.offsetMinutes, dur.months).
The reference engine rejects a component the value’s kind does not
carry, so [component::read] is the whole policy: the reader answers
a component its kind carries or the read is a typed error.
Sourcepub fn equals(&self, other: &Temporal) -> bool
pub fn equals(&self, other: &Temporal) -> bool
Cypher = between two values of the same temporal kind (false for
unlike kinds). The relation is deliberately not the ordering one:
Time— local time and offset, so12:00+01:00and11:00Z(the same instant) are different times, while12:00Zand12:00+00:00are the same.DateTime— local date-time and zone identity, so the two halves of a DST fall-back overlap (02:30+02:00[Europe/Stockholm]and02:30+01:00[Europe/Stockholm]) are equal even though they are different instants, while[Europe/Stockholm]never equals+01:00(ZoneId).
Sourcepub fn datetime_eq_identity(&self) -> Option<(NaiveDateTime, ZoneId)>
pub fn datetime_eq_identity(&self) -> Option<(NaiveDateTime, ZoneId)>
The two components Self::equals compares for a zoned DateTime:
its local wall clock and its ZoneId. None for every other
temporal kind. This is the = identity only; the property index,
uniqueness probe and MERGE key the finer equivalence identity
(UTC instant plus zone), so the two halves of a DST fall-back overlap
are equal yet separate index entries (LABS-785).
Sourcepub fn compare(&self, other: &Temporal) -> Option<Ordering>
pub fn compare(&self, other: &Temporal) -> Option<Ordering>
Three-valued ordering for <, >, <=, >= (None is the null
result of comparing incomparable values):
Time— UTC nanos-of-day (not wrapped at midnight, so it can be negative), then the offset, so two times at the same instant still order.DateTime— instant (nanos included), then offset, then a plain offset before a named zone, then the zone name.Duration— not orderable at all; only=is defined for it.
Sourcepub fn same_instant(&self, other: &Temporal) -> bool
pub fn same_instant(&self, other: &Temporal) -> bool
IS SAME INSTANT (Cypher 25 chronological comparison): the UTC
instant for the two zoned kinds — DateTime by its stored UTC half,
Time by [utc_time_nanos] — and Self::equals for the non-zoned
kinds, whose clock already is the instant. Unlike kinds are false
here too; the operator’s mixed-kind null/false policy stays with the
caller, this relation only answers for a comparable pair.
Sourcepub fn instant_ordering(&self, other: &Temporal) -> Option<Ordering>
pub fn instant_ordering(&self, other: &Temporal) -> Option<Ordering>
IS BEFORE/IS AFTER ordering (Cypher 25): the instant alone for
the zoned kinds — Self::compare also ranks equal instants by
offset and then zone, which a chronological operator must not — and
Self::compare for every other kind (durations stay unordered:
None).
Trait Implementations§
impl Eq for Temporal
impl StructuralPartialEq for Temporal
Auto Trait Implementations§
impl Forget for Temporal
impl Freeze for Temporal
impl Move for Temporal
impl RefUnwindSafe for Temporal
impl Send for Temporal
impl Sync for Temporal
impl Unpin for Temporal
impl UnsafeUnpin for Temporal
impl UnwindSafe for Temporal
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.