pub enum AsCoerceError {
NotSupported {
from: &'static str,
to: &'static str,
},
InvalidData {
message: String,
},
PrecisionLoss {
message: String,
},
Custom(String),
}Expand description
Error type for as.<class>() coercion failures.
This error type provides structured information about why a coercion failed, allowing for meaningful error messages in R.
Variants§
NotSupported
The conversion is not supported for this type combination.
Use this when a type fundamentally cannot be converted to the target type (e.g., trying to convert a non-numeric type to numeric).
InvalidData
The conversion failed due to invalid or malformed data.
Use this when the data itself prevents conversion (e.g., mismatched lengths for data.frame columns, invalid format strings).
PrecisionLoss
The conversion would result in unacceptable precision loss.
Use this when numeric conversion would truncate or lose significant digits beyond acceptable limits.
Custom(String)
A custom error message.
Use this for domain-specific errors that don’t fit the other categories.
Trait Implementations§
Source§impl Clone for AsCoerceError
impl Clone for AsCoerceError
Source§fn clone(&self) -> AsCoerceError
fn clone(&self) -> AsCoerceError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AsCoerceError
impl Debug for AsCoerceError
Source§impl Display for AsCoerceError
impl Display for AsCoerceError
Source§impl Error for AsCoerceError
impl Error for AsCoerceError
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()