pub enum InputErrorKind {
InvalidVolatility {
value: f64,
reason: String,
},
InvalidTime {
value: Positive,
reason: String,
},
InvalidPrice {
value: f64,
reason: String,
},
InvalidRate {
value: f64,
reason: String,
},
InvalidStrike {
value: String,
reason: String,
},
}Expand description
Represents different types of input validation errors that can occur during financial calculations.
This enum encapsulates various error conditions related to the validation of input parameters in financial models, particularly for options pricing and risk analysis. Each variant contains detailed information about the invalid input, including both the problematic value and a reason explaining why it was rejected.
§Variants
-
InvalidVolatility- Represents errors related to improper volatility values such as negative values or unreasonably large inputs that would cause calculation issues. -
InvalidTime- Represents errors related to time inputs (typically time to expiration) that are outside acceptable bounds or otherwise unsuitable for financial calculations. -
InvalidPrice- Represents errors related to price inputs (like underlying asset prices) that are negative or otherwise invalid for the calculation context. -
InvalidRate- Represents errors related to interest rate values that are outside acceptable bounds for the specific financial modeling context. -
InvalidStrike- Represents errors related to strike price inputs that are malformed, out of bounds, or otherwise unsuitable for options calculations.
§Usage
These error kinds are typically used within higher-level error types to provide specific information about validation failures, enabling precise error handling and informative error messages for users.
Variants§
InvalidVolatility
Error indicating an invalid volatility input.
This error occurs when a volatility value is outside acceptable bounds (typically negative values or unreasonably large values) or otherwise invalid for the calculation being performed.
Fields
InvalidTime
Error indicating an invalid time input.
This error occurs when a time value (typically representing time to expiration) is outside acceptable bounds or otherwise invalid for the calculation being performed.
Fields
InvalidPrice
Error indicating an invalid price input.
This error occurs when a price value (such as an underlying asset price) is outside acceptable bounds (typically negative values) or otherwise invalid for the calculation being performed.
Fields
InvalidRate
Error indicating an invalid interest rate input.
This error occurs when an interest rate value is outside acceptable bounds or otherwise invalid for the calculation being performed.
Fields
InvalidStrike
Error indicating an invalid strike price input.
This error occurs when a strike price value is outside acceptable bounds, in an incorrect format, or otherwise invalid for the calculation being performed.
Trait Implementations§
Source§impl Debug for InputErrorKind
impl Debug for InputErrorKind
Source§impl Display for InputErrorKind
impl Display for InputErrorKind
Source§impl Error for InputErrorKind
impl Error for InputErrorKind
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()
Auto Trait Implementations§
impl Freeze for InputErrorKind
impl RefUnwindSafe for InputErrorKind
impl Send for InputErrorKind
impl Sync for InputErrorKind
impl Unpin for InputErrorKind
impl UnsafeUnpin for InputErrorKind
impl UnwindSafe for InputErrorKind
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.