Skip to main content

CalendarQueryError

Enum CalendarQueryError 

Source
#[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 as Unsourced;
  • 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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: CalendarSource

The identity that cannot answer.

§date: NaiveDate

The offending venue-local date.

§

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: CalendarSource

The identity that cannot answer.

§date: NaiveDate

The offending venue-local date.

§

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: CalendarSource

The identity that cannot answer.

§date: NaiveDate

The withheld venue-local date.

§

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.

Fields

§source: CalendarSource

The identity whose search was bounded.

§date: NaiveDate

The venue-local date the search needed to establish.

§bound: NaiveDate

The last venue-local date the bounded search examined.

Implementations§

Source§

impl CalendarQueryError

Source

pub const fn source(self) -> CalendarSource

Returns the identity that cannot answer.

Source

pub const fn date(self) -> NaiveDate

Returns the venue-local date the query could not establish.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CalendarQueryError

Source§

impl Debug for CalendarQueryError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CalendarQueryError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CalendarQueryError

Source§

impl Error for CalendarQueryError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Hash for CalendarQueryError

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CalendarQueryError

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CalendarQueryError

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.