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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StatsError
impl Debug for StatsError
Source§impl Display for StatsError
impl Display for StatsError
Source§impl Error for StatsError
impl Error for StatsError
1.30.0§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl PartialEq for StatsError
impl PartialEq for StatsError
impl StructuralPartialEq for StatsError
Auto Trait Implementations§
impl Freeze for StatsError
impl RefUnwindSafe for StatsError
impl Send for StatsError
impl Sync for StatsError
impl Unpin for StatsError
impl UnwindSafe for StatsError
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)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 more