Enum CurveError
#[non_exhaustive]pub enum CurveError {
BeforeReference {
queried: NaiveDate,
reference: NaiveDate,
},
Malformed(&'static str),
NonFinite {
what: &'static str,
at: Option<NaiveDate>,
},
InvertedDates {
effective: NaiveDate,
termination: NaiveDate,
},
NoFixedRate,
NotASwapTemplate {
family: &'static str,
},
UnknownIndex(Box<UnknownIndexError>),
ParameterCountMismatch {
expected: usize,
given: usize,
},
NoSuchParameter {
index: usize,
count: usize,
},
ReferenceDateMismatch(Box<ReferenceDateMismatch>),
NonPositiveRepoFactor {
at: NaiveDate,
},
}Expand description
A curve query that cannot be answered.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BeforeReference
A query before the curve’s reference date. Discounting backwards is not an extrapolation choice; it is a caller error, so it is reported rather than clamped.
Malformed(&'static str)
A curve was built with no pillars, or with pillars out of order.
NonFinite
A quote that is NaN or infinite was supplied to a curve constructor. Positivity and monotonicity bounds cannot catch NaN — every comparison with it is false — so finiteness is its own check and its own error.
Fields
InvertedDates
A date range whose start is not strictly before its end — a product built with its effective date on or after its termination. Left unchecked this would generate a descending schedule whose coupons carry negative accrual fractions and price to sign-flipped values.
Fields
NoFixedRate
A swap draft was built with no fixed rate stated: the one term a template cannot decide, and one this library never defaults to 0%.
NotASwapTemplate
A swap draft was asked of a template whose family builds no swap.
UnknownIndex(Box<UnknownIndexError>)
A product build referenced a rate-index code the index registry does not know, or one no registered swap template covers.
Boxed: this is the one variant carrying heap-sized detail (the code
and the whole registered list), and it is raised at build time only.
Unboxed it was 48 bytes wide and made every Result<R, CurveError> on
the discount-factor query path 48 bytes — six times the payload it
carries on the way it is actually taken.
ParameterCountMismatch
A substituted lift was handed a parameter vector of the wrong length.
Fields
NoSuchParameter
A seeded lift named a parameter the curve does not have.
Fields
ReferenceDateMismatch(Box<ReferenceDateMismatch>)
A curve was bound to a market that is as of another date — the typed half of the reference-date invariant, raised by a checked binder.
Boxed for the reason UnknownIndex is: it carries
a key, and it is raised at bind time only.
NonPositiveRepoFactor
A repo spread over its base left no positive accrual at a date:
1/P_base + s·τ ≤ 0, so the repo curve has no discount factor there.
A deeply negative special read far out is how this arises.
Implementations§
§impl CurveError
impl CurveError
pub fn is_caller_input(&self) -> bool
pub fn is_caller_input(&self) -> bool
Whether the caller’s input was wrong — a curve built from bad pillars, a product dated backwards, an index nobody registered, a date before the curve begins — rather than a failure inside a lift.
Exhaustive, so a new variant does not compile until someone decides; a binding raises the first kind as the language’s own input error.
Trait Implementations§
§impl Clone for CurveError
impl Clone for CurveError
§fn clone(&self) -> CurveError
fn clone(&self) -> CurveError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CurveError
impl Debug for CurveError
§impl Display for CurveError
impl Display for CurveError
impl Eq for CurveError
§impl Error for CurveError
impl Error for CurveError
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()