#[non_exhaustive]pub enum CalendarQueryError {
BeforeSupportFloor {
source: CalendarSource,
date: NaiveDate,
},
OutsideCoveredRange {
source: CalendarSource,
date: NaiveDate,
},
UnresolvedGap {
source: CalendarSource,
date: NaiveDate,
},
SearchExhausted {
source: CalendarSource,
date: NaiveDate,
bound: NaiveDate,
},
}Expand description
Why an identity-backed date-aware query cannot answer.
LAW-COVERAGE requires an unsupported date to be an explicit error rather than a claim that a market is open or closed, and it requires an unsupported date to stay distinguishable from a bounded search that simply ran out of room to look. The four variants are that distinction:
Self::BeforeSupportFloor— the instant or date precedes the permanent 2010-01-01 local-date floor;Self::OutsideCoveredRange— at or after the floor, but the identity has no sourced answer there: its weekday profile is carried backwards, it ships no holiday table, its holiday layer has no audited answer for the date, or it declares a phase-level gap that applies on the date;Self::UnresolvedGap— inside a covered range on a date the identity explicitly withholds asUnsourced;Self::SearchExhausted— a bounded forward or period search needed a date it could not establish and could not continue past.
A known closure is never an error: a date whose sourced answer is
“closed” — a holiday row, a pre-launch closure, a weekend — returns a normal
Ok result, and so does a genuine absence inside the covered range.
The type carries no allocation and no String: the identity, the offending
venue-local date and, for an exhausted search, the bound it hit. It is
Copy + Send + Sync + 'static so a caller can log or return it without
ceremony.
The mapping from DateCoverage to these variants
is exact in one direction only. A date the metadata calls
DateCoverage::Covered promises that every
query addressed to an instant of it answers, or refuses naming a date the
metadata itself does not call covered (#151) — a wrapped session can open on
the previous civil day, and the next session’s trade date can lie beyond the
day, so the refusal a caller sees on a covered date names the neighbour
the answer depends on, never a market state for the covered date itself.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BeforeSupportFloor
The date precedes the venue-local support floor.
The floor is a local date (SUPPORT_FLOOR), so two identities in
opposing zones reach it at different UTC instants.
Fields
source: CalendarSourceThe identity that cannot answer.
OutsideCoveredRange
The date is at or after the floor but outside the ranges this identity has a sourced answer for.
Either the weekday profile is carried backwards below the identity’s
recorded horizon, the date falls outside every holiday window the
identity’s built-in table audited, or a declared phase-level gap applies
on the date. The reason is available from
CalendarCoverage::gaps, which reports
the same derivation as spans.
Fields
source: CalendarSourceThe identity that cannot answer.
UnresolvedGap
The date is inside an audited window on a date the identity explicitly
withholds as Unsourced, or the date sits on a one-flank bridged span
below the identity’s first audited window, whose holiday-table
classification refuses (issue #296, the 2026-10-07 ruling).
The withheld case is the one LAW-HOLIDAY-SCOPE means by “a date without
a row is audited normal, while Unsourced expressly withholds that
claim”. The one-flank case is the ruling’s asymmetry with two-flank
bridged spans: a date whose session questions answer from the sourced
normal week still refuses is_closed_trade_date, because no audited
window brackets it from below and nothing witnesses the holiday layer —
two flanks bracket a span, one does not. Either way the crate has no
answer and will not guess one, and
Self::normal_week_baseline names the sourced week the refusal sits
inside.
Fields
source: CalendarSourceThe identity that cannot answer.
SearchExhausted
A bounded search ran out of room on a date it could not establish.
A forward or period search inspects at most a documented bounded number of venue-local days. When the date it needs next is one it cannot establish, the search stops here rather than skipping it and claiming the next known session is the next session.
Implementations§
Source§impl CalendarQueryError
impl CalendarQueryError
Sourcepub const fn source(self) -> CalendarSource
pub const fn source(self) -> CalendarSource
Returns the identity that cannot answer.
Sourcepub const fn date(self) -> NaiveDate
pub const fn date(self) -> NaiveDate
Returns the venue-local date the query could not establish.
Sourcepub fn normal_week_baseline(self) -> Option<NormalWeekBaseline>
pub fn normal_week_baseline(self) -> Option<NormalWeekBaseline>
Returns the sourced normal-week baseline the refused date sits inside,
or None when the crate states none (issue #296, Tier 3).
This is the context a consumer needs to make its own call beside a
refusal: the weekday the refused date falls on and the normal-week
windows the identity’s sourced timeline serves there — “Wednesday;
normal week open 09:30-16:30” — rendered by
NormalWeekBaseline’s Display. The enrichment is additive: the
refusal is unchanged, and the baseline says nothing about the holiday
arrangement the refusal withholds.
The baseline is absent where claiming one would state a sourced fact the ledger does not record: the date precedes the support floor, or the identity’s normal week is carried backwards below its recorded horizon at the date.
Trait Implementations§
Source§impl Clone for CalendarQueryError
impl Clone for CalendarQueryError
impl Copy for CalendarQueryError
Source§impl Debug for CalendarQueryError
impl Debug for CalendarQueryError
Source§impl Display for CalendarQueryError
impl Display for CalendarQueryError
impl Eq for CalendarQueryError
Source§impl Error for CalendarQueryError
impl Error for CalendarQueryError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()