pub enum StatsError {
InvalidInput {
message: String,
},
ConversionError {
message: String,
},
EmptyData {
message: String,
},
DimensionMismatch {
message: String,
},
NumericalError {
message: String,
},
NotFitted {
message: String,
},
InvalidParameter {
message: String,
},
IndexOutOfBounds {
message: String,
},
MathematicalError {
message: String,
},
}Expand description
Main error type for the rs-stats library
This enum represents all possible errors that can occur in the library. Each variant includes a message providing context about the error.
§Examples
use rs_stats::error::{StatsError, StatsResult};
fn example() -> StatsResult<f64> {
Err(StatsError::InvalidInput {
message: "Value must be positive".to_string(),
})
}Variants§
InvalidInput
Invalid input parameters provided to a function
ConversionError
Type conversion failure
EmptyData
Empty data provided when data is required
DimensionMismatch
Dimension mismatch between arrays/vectors
NumericalError
Numerical computation error (overflow, underflow, NaN, etc.)
NotFitted
Model not fitted/trained before use
InvalidParameter
Invalid parameter value
IndexOutOfBounds
Index out of bounds
MathematicalError
Division by zero or similar mathematical error
Implementations§
Source§impl StatsError
impl StatsError
Sourcepub fn invalid_input<S: Into<String>>(message: S) -> Self
pub fn invalid_input<S: Into<String>>(message: S) -> Self
Create an InvalidInput error
Sourcepub fn conversion_error<S: Into<String>>(message: S) -> Self
pub fn conversion_error<S: Into<String>>(message: S) -> Self
Create a ConversionError
Sourcepub fn empty_data<S: Into<String>>(message: S) -> Self
pub fn empty_data<S: Into<String>>(message: S) -> Self
Create an EmptyData error
Sourcepub fn dimension_mismatch<S: Into<String>>(message: S) -> Self
pub fn dimension_mismatch<S: Into<String>>(message: S) -> Self
Create a DimensionMismatch error
Sourcepub fn numerical_error<S: Into<String>>(message: S) -> Self
pub fn numerical_error<S: Into<String>>(message: S) -> Self
Create a NumericalError
Sourcepub fn not_fitted<S: Into<String>>(message: S) -> Self
pub fn not_fitted<S: Into<String>>(message: S) -> Self
Create a NotFitted error
Sourcepub fn invalid_parameter<S: Into<String>>(message: S) -> Self
pub fn invalid_parameter<S: Into<String>>(message: S) -> Self
Create an InvalidParameter error
Sourcepub fn index_out_of_bounds<S: Into<String>>(message: S) -> Self
pub fn index_out_of_bounds<S: Into<String>>(message: S) -> Self
Create an IndexOutOfBounds error
Sourcepub fn mathematical_error<S: Into<String>>(message: S) -> Self
pub fn mathematical_error<S: Into<String>>(message: S) -> Self
Create a MathematicalError
Trait Implementations§
Source§impl Clone for StatsError
impl Clone for StatsError
Source§fn clone(&self) -> StatsError
fn clone(&self) -> StatsError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more