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>,
},
CivilZoned(Box<CivilZonedFields>),
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
CivilZoned(Box<CivilZonedFields>)
Out-of-range zoned datetime (TCK ±999999999): the wall clock as
proleptic civil fields — CivilZonedFields, Temporal::CivilDateTime’s
payload plus the offset and optional zone spelling
Temporal::DateTime carries. Only an offset or Z zone spec
constructs one (ADR-0683); the instant is the wall clock minus the
offset, computed over the wide day arithmetic and never a chrono
conversion. The payload is boxed: unboxed it is 56 bytes against
the chrono DateTime variant’s 48, and Temporal growing past 48
grows every row’s Value with it — the far-year form is rare
enough to pay one allocation instead.
Duration
Implementations§
Source§impl Temporal
impl Temporal
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<(WallClockParts, ZoneId)>
pub fn datetime_eq_identity(&self) -> Option<(WallClockParts, ZoneId)>
The two components Self::equals compares for a zoned datetime —
either representation, the civil far-year form included (ADR-0683):
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, Self::zoned_instant_identity), so the
two halves of a DST fall-back overlap are equal yet separate index
entries (LABS-785).
Sourcepub fn zoned_instant_identity(&self) -> Option<(i128, ZoneId)>
pub fn zoned_instant_identity(&self) -> Option<(i128, ZoneId)>
The zoned datetime’s identity for the property index, uniqueness
probe and MERGE key (LABS-785): the UTC instant plus ZoneId —
finer than Self::datetime_eq_identity’s wall clock and zone, so
the two halves of a DST fall-back overlap are =-equal yet separate
entries. None for every non-zoned kind. The executor’s group key
reads this one derivation, so a representation added to the zoned
partition can never fork the equivalence.
Sourcepub fn zoned_parts(&self) -> Option<ZonedParts<'_>>
pub fn zoned_parts(&self) -> Option<ZonedParts<'_>>
The zoned facts every consumer reads (ADR-0683): the wide UTC
instant in epoch nanoseconds, the offset, and the already-classified
IANA region (None for a plain offset spelling). None for every
non-zoned kind. The relations derive from the one [kind_key], and
so does the Bolt encoder, which needs exactly these three — one
derivation, never a per-consumer reassembly of the instant.
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). The dispatch is the
[kind_key] pair — the one key-level spelling of the variant
grouping (Temporal::kind stays the kind-level discriminant) — so
each kind’s two representations compare through one key:
Date— the proleptic calendar triple, so DATE’s chrono and civil forms share one order.LocalDateTime— the wall clock parts, likewise.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— the [ZonedView]’s 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.
Unlike kinds answer None (the null result).
Sourcepub fn same_instant(&self, other: &Temporal) -> bool
pub fn same_instant(&self, other: &Temporal) -> bool
IS SAME INSTANT (Cypher 25 chronological comparison): the instant
for the two instant-bearing kinds — DateTime (either
representation) and Time — is Self::instant_ordering’s
equality, one derivation for both; 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 two instant-bearing 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).
Source§impl Temporal
impl Temporal
Sourcepub fn kind(&self) -> TemporalKind
pub fn kind(&self) -> TemporalKind
This value’s type kind — the one spelling of the variant grouping (the civil out-of-range forms share their kind’s name).
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.
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.