Skip to main content

IntoRAs

Trait IntoRAs 

Source
pub trait IntoRAs<Target> {
    // Required method
    fn into_r_as(self) -> Result<SEXP, StorageCoerceError>;
}
Expand description

Storage-directed conversion to R SEXP.

This trait allows converting Rust values to R with an explicit target storage type. The conversion is value-based: it succeeds if all values fit the target type, and fails otherwise.

§Target Types

  • i32 → R integer (INTSXP)
  • f64 → R numeric (REALSXP)
  • RLogical → R logical (LGLSXP)
  • u8 → R raw (RAWSXP)
  • String → R character (STRSXP)

§Example

use miniextendr_api::IntoRAs;

// Convert i64 to R integer (if values fit)
let x: Vec<i64> = vec![1, 2, 3];
let sexp = x.into_r_as::<i32>()?;

// Convert f64 to R integer (if values are integral)
let y: Vec<f64> = vec![1.0, 2.0, 3.0];
let sexp = y.into_r_as::<i32>()?;

Required Methods§

Source

fn into_r_as(self) -> Result<SEXP, StorageCoerceError>

Convert to R SEXP with the specified target storage type.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoRAs<RLogical> for &[bool]

Source§

impl IntoRAs<RLogical> for Vec<bool>

Source§

impl IntoRAs<RLogical> for bool

Source§

impl IntoRAs<RLogical> for i32

Source§

impl IntoRAs<String> for &[&str]

Source§

impl IntoRAs<String> for &[String]

Source§

impl IntoRAs<String> for &str

Source§

impl IntoRAs<String> for String

Source§

impl IntoRAs<String> for Vec<&str>

Source§

impl IntoRAs<String> for Vec<String>

Source§

impl IntoRAs<String> for Vec<bool>

Source§

impl IntoRAs<String> for Vec<f64>

Source§

impl IntoRAs<String> for Vec<i32>

Source§

impl IntoRAs<String> for Vec<i64>

Source§

impl IntoRAs<String> for bool

Source§

impl IntoRAs<String> for f32

Source§

impl IntoRAs<String> for f64

Source§

impl IntoRAs<String> for i32

Source§

impl IntoRAs<String> for i64

Source§

impl IntoRAs<f64> for &[bool]

Source§

impl IntoRAs<f64> for &[f32]

Source§

impl IntoRAs<f64> for &[f64]

Source§

impl IntoRAs<f64> for &[i8]

Source§

impl IntoRAs<f64> for &[i16]

Source§

impl IntoRAs<f64> for &[i32]

Source§

impl IntoRAs<f64> for &[i64]

Source§

impl IntoRAs<f64> for &[isize]

Source§

impl IntoRAs<f64> for &[u8]

Source§

impl IntoRAs<f64> for &[u16]

Source§

impl IntoRAs<f64> for &[u32]

Source§

impl IntoRAs<f64> for &[u64]

Source§

impl IntoRAs<f64> for &[usize]

Source§

impl IntoRAs<f64> for Vec<bool>

Source§

impl IntoRAs<f64> for Vec<f32>

Source§

impl IntoRAs<f64> for Vec<f64>

Source§

impl IntoRAs<f64> for Vec<i8>

Source§

impl IntoRAs<f64> for Vec<i16>

Source§

impl IntoRAs<f64> for Vec<i32>

Source§

impl IntoRAs<f64> for Vec<i64>

Source§

impl IntoRAs<f64> for Vec<isize>

Source§

impl IntoRAs<f64> for Vec<u8>

Source§

impl IntoRAs<f64> for Vec<u16>

Source§

impl IntoRAs<f64> for Vec<u32>

Source§

impl IntoRAs<f64> for Vec<u64>

Source§

impl IntoRAs<f64> for Vec<usize>

Source§

impl IntoRAs<f64> for bool

Source§

impl IntoRAs<f64> for f32

Source§

impl IntoRAs<f64> for f64

Source§

impl IntoRAs<f64> for i8

Source§

impl IntoRAs<f64> for i16

Source§

impl IntoRAs<f64> for i32

Source§

impl IntoRAs<f64> for i64

Source§

impl IntoRAs<f64> for isize

Source§

impl IntoRAs<f64> for u8

Source§

impl IntoRAs<f64> for u16

Source§

impl IntoRAs<f64> for u32

Source§

impl IntoRAs<f64> for u64

Source§

impl IntoRAs<f64> for usize

Source§

impl IntoRAs<i32> for &[bool]

Source§

impl IntoRAs<i32> for &[f32]

Source§

impl IntoRAs<i32> for &[f64]

Source§

impl IntoRAs<i32> for &[i8]

Source§

impl IntoRAs<i32> for &[i16]

Source§

impl IntoRAs<i32> for &[i32]

Source§

impl IntoRAs<i32> for &[i64]

Source§

impl IntoRAs<i32> for &[isize]

Source§

impl IntoRAs<i32> for &[u8]

Source§

impl IntoRAs<i32> for &[u16]

Source§

impl IntoRAs<i32> for &[u32]

Source§

impl IntoRAs<i32> for &[u64]

Source§

impl IntoRAs<i32> for &[usize]

Source§

impl IntoRAs<i32> for Vec<bool>

Source§

impl IntoRAs<i32> for Vec<f32>

Source§

impl IntoRAs<i32> for Vec<f64>

Source§

impl IntoRAs<i32> for Vec<i8>

Source§

impl IntoRAs<i32> for Vec<i16>

Source§

impl IntoRAs<i32> for Vec<i32>

Source§

impl IntoRAs<i32> for Vec<i64>

Source§

impl IntoRAs<i32> for Vec<isize>

Source§

impl IntoRAs<i32> for Vec<u8>

Source§

impl IntoRAs<i32> for Vec<u16>

Source§

impl IntoRAs<i32> for Vec<u32>

Source§

impl IntoRAs<i32> for Vec<u64>

Source§

impl IntoRAs<i32> for Vec<usize>

Source§

impl IntoRAs<i32> for bool

Source§

impl IntoRAs<i32> for f32

Source§

impl IntoRAs<i32> for f64

Source§

impl IntoRAs<i32> for i8

Source§

impl IntoRAs<i32> for i16

Source§

impl IntoRAs<i32> for i32

Source§

impl IntoRAs<i32> for i64

Source§

impl IntoRAs<i32> for isize

Source§

impl IntoRAs<i32> for u8

Source§

impl IntoRAs<i32> for u16

Source§

impl IntoRAs<i32> for u32

Source§

impl IntoRAs<i32> for u64

Source§

impl IntoRAs<i32> for usize

Source§

impl IntoRAs<u8> for &[f32]

Source§

impl IntoRAs<u8> for &[f64]

Source§

impl IntoRAs<u8> for &[i8]

Source§

impl IntoRAs<u8> for &[i16]

Source§

impl IntoRAs<u8> for &[i32]

Source§

impl IntoRAs<u8> for &[i64]

Source§

impl IntoRAs<u8> for &[isize]

Source§

impl IntoRAs<u8> for &[u8]

Source§

impl IntoRAs<u8> for &[u16]

Source§

impl IntoRAs<u8> for &[u32]

Source§

impl IntoRAs<u8> for &[u64]

Source§

impl IntoRAs<u8> for &[usize]

Source§

impl IntoRAs<u8> for Vec<f32>

Source§

impl IntoRAs<u8> for Vec<f64>

Source§

impl IntoRAs<u8> for Vec<i8>

Source§

impl IntoRAs<u8> for Vec<i16>

Source§

impl IntoRAs<u8> for Vec<i32>

Source§

impl IntoRAs<u8> for Vec<i64>

Source§

impl IntoRAs<u8> for Vec<isize>

Source§

impl IntoRAs<u8> for Vec<u8>

Source§

impl IntoRAs<u8> for Vec<u16>

Source§

impl IntoRAs<u8> for Vec<u32>

Source§

impl IntoRAs<u8> for Vec<u64>

Source§

impl IntoRAs<u8> for Vec<usize>

Source§

impl IntoRAs<u8> for f32

Source§

impl IntoRAs<u8> for f64

Source§

impl IntoRAs<u8> for i8

Source§

impl IntoRAs<u8> for i16

Source§

impl IntoRAs<u8> for i32

Source§

impl IntoRAs<u8> for i64

Source§

impl IntoRAs<u8> for isize

Source§

impl IntoRAs<u8> for u8

Source§

impl IntoRAs<u8> for u16

Source§

impl IntoRAs<u8> for u32

Source§

impl IntoRAs<u8> for u64

Source§

impl IntoRAs<u8> for usize

Implementors§