Skip to main content

CurveError

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
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.
§

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.

Fields

§queried: NaiveDate

The date queried.

§reference: NaiveDate

The curve’s reference date.

§

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

§what: &'static str

What the quote was for: “discount factor”, “hazard rate”, …

§at: Option<NaiveDate>

The pillar date the quote was supplied at, where the quote is dated.

§

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

§effective: NaiveDate

The start of the range — a product’s effective date.

§termination: NaiveDate

The end of the range — a product’s termination date.

§

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.

Fields

§family: &'static str

The family’s name, as the template registry spells it.

§

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

§expected: usize

How many free parameters the curve has, counting every curve it reads.

§given: usize

How many were supplied.

§

NoSuchParameter

A seeded lift named a parameter the curve does not have.

Fields

§index: usize

The index asked for.

§count: usize

How many free parameters the curve actually has, counting every curve it reads.

§

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.

Fields

§at: NaiveDate

The date read.

Implementations§

§

impl CurveError

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

§

fn clone(&self) -> CurveError

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
§

impl Debug for CurveError

§

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

Formats the value using the given formatter. Read more
§

impl Display for CurveError

§

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

Formats the value using the given formatter. Read more
§

impl Eq for CurveError

§

impl Error for CurveError

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
§

impl From<CurveError> for PnlError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl From<CurveError> for CalibrationError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl From<CurveError> for CashflowError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl From<CurveError> for LinkerQuoteError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl From<CurveError> for SpreadSolveError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl From<CurveError> for PricingError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl From<CurveError> for ScenarioError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl PartialEq for CurveError

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for CurveError

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.