pub trait TermStructure: AsObservable {
Show 14 methods
// Required methods
fn base(&self) -> &TermStructureBase;
fn max_date(&self) -> Date;
// Provided methods
fn day_counter(&self) -> Option<DayCounter> { ... }
fn require_day_counter(&self) -> QlResult<DayCounter> { ... }
fn calendar(&self) -> Option<Calendar> { ... }
fn settlement_days(&self) -> QlResult<Natural> { ... }
fn reference_date(&self) -> QlResult<Date> { ... }
fn time_from_reference(&self, date: Date) -> QlResult<Time> { ... }
fn max_time(&self) -> QlResult<Time> { ... }
fn allows_extrapolation(&self) -> bool { ... }
fn enable_extrapolation(&self) { ... }
fn disable_extrapolation(&self) { ... }
fn check_range_date(&self, date: Date, extrapolate: bool) -> QlResult<()> { ... }
fn check_range_time(&self, t: Time, extrapolate: bool) -> QlResult<()> { ... }
}Expand description
Basic term-structure functionality.
Mirrors QuantLib’s TermStructure interface; the provided methods
delegate to the embedded TermStructureBase exactly as the C++ base
class implements them, and a concrete curve overrides the ones it manages
itself (typically reference_date when built via
TermStructureBase::new).
Required Methods§
Sourcefn base(&self) -> &TermStructureBase
fn base(&self) -> &TermStructureBase
The embedded shared holder.
Provided Methods§
Sourcefn day_counter(&self) -> Option<DayCounter>
fn day_counter(&self) -> Option<DayCounter>
The day counter used for date/time conversion, when provided.
Sourcefn require_day_counter(&self) -> QlResult<DayCounter>
fn require_day_counter(&self) -> QlResult<DayCounter>
The day counter, or an error for structures built without one.
Sourcefn calendar(&self) -> Option<Calendar>
fn calendar(&self) -> Option<Calendar>
The calendar used for reference-date calculation, when provided.
Sourcefn settlement_days(&self) -> QlResult<Natural>
fn settlement_days(&self) -> QlResult<Natural>
The settlement days used for reference-date calculation.
Sourcefn reference_date(&self) -> QlResult<Date>
fn reference_date(&self) -> QlResult<Date>
The date at which discount = 1.0 and/or variance = 0.0.
Sourcefn time_from_reference(&self, date: Date) -> QlResult<Time>
fn time_from_reference(&self, date: Date) -> QlResult<Time>
The period from the reference date to date as a year fraction.
Sourcefn allows_extrapolation(&self) -> bool
fn allows_extrapolation(&self) -> bool
Whether the curve answers dates/times beyond its maximum.
Sourcefn enable_extrapolation(&self)
fn enable_extrapolation(&self)
Allows extrapolation past the maximum date/time.
Sourcefn disable_extrapolation(&self)
fn disable_extrapolation(&self)
Forbids extrapolation past the maximum date/time.
Sourcefn check_range_date(&self, date: Date, extrapolate: bool) -> QlResult<()>
fn check_range_date(&self, date: Date, extrapolate: bool) -> QlResult<()>
Date-range check: date must not precede the reference date nor,
unless extrapolation applies, exceed the maximum date.
Sourcefn check_range_time(&self, t: Time, extrapolate: bool) -> QlResult<()>
fn check_range_time(&self, t: Time, extrapolate: bool) -> QlResult<()>
Time-range check: t must be finite, non-negative and, unless
extrapolation applies, within the maximum time.
The t >= 0 requirement is QuantLib’s checkRange
(termstructure.cpp:66). Divergence: the finiteness clause. +inf
passes t >= 0 in C++, and an extrapolating curve never compares it
against maxTime(), so it reaches the interpolator unchecked.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".