pub(crate) enum CoercionMapping {
Numeric,
Bool,
BoolVec,
NativeInt,
NativeIntVec,
NativeReal,
NativeRealVec,
}Expand description
Conversion selected by coerce, shared by Rust conversion and R checks.
Variants§
Numeric
Numeric scalars and vectors already have checked, multi-source converters.
Bool
Keep logical scalars and additionally accept integer zero or one.
BoolVec
Keep logical vectors and additionally accept integer zeros and ones.
NativeInt
Native i32: keep INTSXP, additionally accept whole-valued doubles,
logicals, and raws.
NativeIntVec
Native Vec<i32>: element-wise form of Self::NativeInt.
NativeReal
Native f64: keep REALSXP, additionally accept integers, logicals, and raws.
NativeRealVec
Native Vec<f64>: element-wise form of Self::NativeReal.
Implementations§
Source§impl CoercionMapping
impl CoercionMapping
Sourcepub(crate) fn from_type(ty: &Type) -> Option<Self>
pub(crate) fn from_type(ty: &Type) -> Option<Self>
Recognize the scalar and vector types supported by coerce.
Numeric conversion preserves all sources accepted by TryFromSexp:
integer, double, logical, and raw. Booleans extend their logical-only
converter with integer zero/one input. The native i32 / f64 scalars
and vectors, whose bare conversion accepts one SEXPTYPE, widen to the
same four sources (whole-valued doubles only for i32). Borrowed slices
and other types keep TryFromSexp.
Auto Trait Implementations§
impl Freeze for CoercionMapping
impl RefUnwindSafe for CoercionMapping
impl Send for CoercionMapping
impl Sync for CoercionMapping
impl Unpin for CoercionMapping
impl UnsafeUnpin for CoercionMapping
impl UnwindSafe for CoercionMapping
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> 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: 1 byte
Size for each variant:
Numeric: 0 bytesBool: 0 bytesBoolVec: 0 bytesNativeInt: 0 bytesNativeIntVec: 0 bytesNativeReal: 0 bytesNativeRealVec: 0 bytes