pub enum RCoerceError {
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 RCoerceError
impl Clone for RCoerceError
Source§fn clone(&self) -> RCoerceError
fn clone(&self) -> RCoerceError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RCoerceError
impl Debug for RCoerceError
Source§impl Display for RCoerceError
impl Display for RCoerceError
Source§impl Error for RCoerceError
impl Error for RCoerceError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Source§#[doc(hidden)]fn type_id(&self, _: Internal) -> TypeIdwhere
Self: 'static,
#[doc(hidden)]fn type_id(&self, _: Internal) -> TypeIdwhere
Self: 'static,
error_type_id)TypeId of self.1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<&str> for RCoerceError
impl From<&str> for RCoerceError
Auto Trait Implementations§
impl Freeze for RCoerceError
impl RefUnwindSafe for RCoerceError
impl Send for RCoerceError
impl Sync for RCoerceError
impl Unpin for RCoerceError
impl UnsafeUnpin for RCoerceError
impl UnwindSafe for RCoerceError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> RDisplay for Twhere
T: Display,
impl<T> RDisplay for Twhere
T: Display,
Source§fn as_r_string(&self) -> String
fn as_r_string(&self) -> String
Source§impl<T> RError for Twhere
T: Error,
impl<T> RError for Twhere
T: Error,
Source§fn error_message(&self) -> String
fn error_message(&self) -> String
Source§fn error_chain(&self) -> Vec<String>
fn error_chain(&self) -> Vec<String>
Source§fn error_chain_length(&self) -> i32
fn error_chain_length(&self) -> i32
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes
Size for each variant:
NotSupported: 32 bytesInvalidData: 24 bytesPrecisionLoss: 24 bytesCustom: 24 bytes