pub struct TermStructure(/* private fields */);Expand description
Strictly maturity-ordered, non-decreasing ATM total-variance knots.
§Examples
use regit_svi::TermStructure;
let term = TermStructure::try_from(vec![(0.5, 0.02), (1.0, 0.04)])?;
assert_eq!(term.len(), 2);
assert!(TermStructure::try_from(vec![(1.0, 0.04), (0.5, 0.02)]).is_err());Implementations§
Source§impl TermStructure
impl TermStructure
Sourcepub fn new(knots: Vec<(Maturity, TotalVariance)>) -> Result<Self, ParamError>
pub fn new(knots: Vec<(Maturity, TotalVariance)>) -> Result<Self, ParamError>
Creates a term structure without sorting or repairing its input.
§Errors
Returns ParamError::EmptyCollection for empty input,
ParamError::NonPositiveTheta for a zero theta,
ParamError::NotStrictlyIncreasing for unordered or duplicate
maturities, or ParamError::DecreasingAtmVariance for decreasing ATM
total variance. Typed knots already guarantee finiteness and maturity
positivity.
Sourcepub fn knots(&self) -> &[(Maturity, TotalVariance)]
pub fn knots(&self) -> &[(Maturity, TotalVariance)]
Returns the validated knots.
Trait Implementations§
Source§impl Clone for TermStructure
impl Clone for TermStructure
Source§fn clone(&self) -> TermStructure
fn clone(&self) -> TermStructure
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TermStructure
impl Debug for TermStructure
Source§impl PartialEq for TermStructure
impl PartialEq for TermStructure
impl StructuralPartialEq for TermStructure
Auto Trait Implementations§
impl Freeze for TermStructure
impl RefUnwindSafe for TermStructure
impl Send for TermStructure
impl Sync for TermStructure
impl Unpin for TermStructure
impl UnsafeUnpin for TermStructure
impl UnwindSafe for TermStructure
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more