pub trait IntoR {
type Error: Display;
// Required method
fn try_into_sexp(self) -> Result<SEXP, Self::Error>;
// Provided methods
unsafe fn try_into_sexp_unchecked(self) -> Result<SEXP, Self::Error>
where Self: Sized { ... }
fn into_sexp(self) -> SEXP
where Self: Sized { ... }
unsafe fn into_sexp_unchecked(self) -> SEXP
where Self: Sized { ... }
}Expand description
Trait for converting Rust types to R SEXP values.
Outbound counterpart of crate::from_r::TryFromSexp. This is the lax
path for 64-bit integer types — values that overflow i32 silently land
as REALSXP. For the strict alternative, see crate::strict and the
#[miniextendr(strict)] attribute.
§Required Method
Implementors must provide try_into_sexp and
specify Error. The other three methods have sensible
defaults.
§Examples
use miniextendr_api::into_r::IntoR;
let sexp = 42i32.into_sexp();
let sexp = "hello".to_string().into_sexp();
// Fallible path:
let result = "hello".try_into_sexp();
assert!(result.is_ok());Required Associated Types§
Sourcetype Error: Display
type Error: Display
The error type for fallible conversions.
Use std::convert::Infallible for types that can never fail.
Use IntoRError for types
that may fail (e.g. strings exceeding R’s i32 length limit).
Required Methods§
Sourcefn try_into_sexp(self) -> Result<SEXP, Self::Error>
fn try_into_sexp(self) -> Result<SEXP, Self::Error>
Try to convert this value to an R SEXP.
This is the required method. All other methods delegate to it.
Provided Methods§
Sourcefn into_sexp(self) -> SEXPwhere
Self: Sized,
fn into_sexp(self) -> SEXPwhere
Self: Sized,
Convert this value to an R SEXP, panicking on error.
In debug builds, asserts that we’re on R’s main thread.
Sourceunsafe fn into_sexp_unchecked(self) -> SEXPwhere
Self: Sized,
unsafe fn into_sexp_unchecked(self) -> SEXPwhere
Self: Sized,
Convert to SEXP without thread safety checks, panicking on error.
§Safety
Must be called from R’s main thread. In debug builds, this still calls the checked version by default, but implementations may skip thread assertions for performance.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl IntoR for &[Rboolean]
Convert &[Rboolean] to R logical vector (no NA: Rboolean is TRUE/FALSE only).
impl IntoR for &[Rboolean]
Convert &[Rboolean] to R logical vector (no NA: Rboolean is TRUE/FALSE only).
Source§impl IntoR for Infallible
impl IntoR for Infallible
Source§impl IntoR for Option<&str>
Convert Option<&str> to R: Some(s) → character, None → NA_character_.
impl IntoR for Option<&str>
Convert Option<&str> to R: Some(s) → character, None → NA_character_.
This is a deliberate exception to the generic Option<&T> where T: Copy blanket impl below (which returns NULL for None, not NA).
str is unsized, so it can’t satisfy that impl’s Copy bound —
&str gets its own hand-written impl here instead, and it’s written to
mirror Option<String>’s NA semantics rather than the reference-type
NULL semantics. See the module-level “absence contract” doc on
crate::into_r for the full return-category table.
Source§impl IntoR for Option<AsCharacter>
impl IntoR for Option<AsCharacter>
Source§impl IntoR for Option<AsCharacterVec>
impl IntoR for Option<AsCharacterVec>
Source§impl IntoR for Option<AsNumericVec>
impl IntoR for Option<AsNumericVec>
Source§impl IntoR for Option<BTreeSet<String>>
Convert Option<BTreeSet<String>> to R: Some(set) -> character vector, None -> NULL.
impl IntoR for Option<BTreeSet<String>>
Convert Option<BTreeSet<String>> to R: Some(set) -> character vector, None -> NULL.
Source§impl IntoR for Option<HashSet<String>>
Convert Option<HashSet<String>> to R: Some(set) -> character vector, None -> NULL.
impl IntoR for Option<HashSet<String>>
Convert Option<HashSet<String>> to R: Some(set) -> character vector, None -> NULL.
Source§impl IntoR for Option<List>
Some(list) → the list, None → NULL: the inverse of
TryFromSexp for Option<List>.
impl IntoR for Option<List>
Some(list) → the list, None → NULL: the inverse of
TryFromSexp for Option<List>.
Source§impl IntoR for Option<ListMut>
Some(list) → the list, None → NULL: the inverse of
TryFromSexp for Option<ListMut>.
impl IntoR for Option<ListMut>
Some(list) → the list, None → NULL: the inverse of
TryFromSexp for Option<ListMut>.
Source§impl IntoR for Option<OsString>
Convert Option<OsString> to R: Some(s) -> character, None -> NA_character_.
impl IntoR for Option<OsString>
Convert Option<OsString> to R: Some(s) -> character, None -> NA_character_.
Source§impl IntoR for Option<PathBuf>
Convert Option<PathBuf> to R: Some(path) -> character, None -> NA_character_.
impl IntoR for Option<PathBuf>
Convert Option<PathBuf> to R: Some(path) -> character, None -> NA_character_.
Source§impl IntoR for OsString
Convert OsString to R character scalar.
impl IntoR for OsString
Convert OsString to R character scalar.
On Unix, strings that are not valid UTF-8 will produce lossy output (invalid sequences replaced with U+FFFD).
Source§impl IntoR for PathBuf
Convert PathBuf to R character scalar.
impl IntoR for PathBuf
Convert PathBuf to R character scalar.
On Unix, paths that are not valid UTF-8 will produce lossy output (invalid sequences replaced with U+FFFD).
Source§impl IntoR for Vec<List>
Convert a Vec<List> to an R list-column (VECSXP).
impl IntoR for Vec<List>
Convert a Vec<List> to an R list-column (VECSXP).
Each element becomes an R list in the output VECSXP. The elements must be
rooted by the caller (for example, elements of an argument list): this
allocates the column first. To build the lists as you go, use
into_list_column.
Source§impl IntoR for Vec<Option<&str>>
Convert Vec<Option<&str>> to R character vector with NA support.
impl IntoR for Vec<Option<&str>>
Convert Vec<Option<&str>> to R character vector with NA support.
None values become NA_character_ in R. Borrowed analogue of Vec<Option<String>>.
Source§impl IntoR for Vec<Option<Cow<'_, str>>>
Convert Vec<Option<Cow<'_, str>>> to R character vector with NA support.
impl IntoR for Vec<Option<Cow<'_, str>>>
Convert Vec<Option<Cow<'_, str>>> to R character vector with NA support.
None values become NA_character_ in R.
Source§impl IntoR for Vec<Option<List>>
Convert a Vec<Option<List>> to an R list-column (VECSXP).
impl IntoR for Vec<Option<List>>
Convert a Vec<Option<List>> to an R list-column (VECSXP).
Some(list) elements are placed directly as list elements; None elements
become R_NilValue. As with Vec<List>, the elements must be rooted by
the caller; into_option_list_column builds them as it goes.
Source§impl IntoR for Vec<Option<OsString>>
Convert Vec<Option<OsString>> to R character vector with NA support.
impl IntoR for Vec<Option<OsString>>
Convert Vec<Option<OsString>> to R character vector with NA support.
Source§impl IntoR for Vec<Option<PathBuf>>
Convert Vec<Option<PathBuf>> to R character vector with NA support.
impl IntoR for Vec<Option<PathBuf>>
Convert Vec<Option<PathBuf>> to R character vector with NA support.
Source§impl IntoR for Vec<Option<RLogical>>
Convert Vec<Option<RLogical>> to R logical vector with NA support.
impl IntoR for Vec<Option<RLogical>>
Convert Vec<Option<RLogical>> to R logical vector with NA support.
Source§impl IntoR for Vec<Option<Rboolean>>
Convert Vec<Option<Rboolean>> to R logical vector with NA support.
impl IntoR for Vec<Option<Rboolean>>
Convert Vec<Option<Rboolean>> to R logical vector with NA support.
Source§impl IntoR for Vec<Option<String>>
Convert Vec<Option<String>> to R character vector with NA support.
impl IntoR for Vec<Option<String>>
Convert Vec<Option<String>> to R character vector with NA support.
None values become NA_character_ in R.
Source§impl IntoR for Vec<Option<bool>>
Convert Vec<Option<bool>> to R logical vector with NA support.
impl IntoR for Vec<Option<bool>>
Convert Vec<Option<bool>> to R logical vector with NA support.
Source§impl IntoR for Vec<Rboolean>
Convert Vec<Rboolean> to R logical vector (no NA: Rboolean is TRUE/FALSE only).
impl IntoR for Vec<Rboolean>
Convert Vec<Rboolean> to R logical vector (no NA: Rboolean is TRUE/FALSE only).
Source§impl IntoR for i64
Convert i64 to R integer (INTSXP) or numeric (REALSXP).
impl IntoR for i64
Convert i64 to R integer (INTSXP) or numeric (REALSXP).
Uses smart conversion: values in (i32::MIN, i32::MAX] are returned as
R integers for exact representation. Values outside that range (including
i32::MIN which is NA_integer_ in R) fall back to R doubles.
let small: i64 = 42;
small.into_sexp(); // R integer 42L
let big: i64 = 3_000_000_000;
big.into_sexp(); // R double 3e9
let na_trap: i64 = i32::MIN as i64;
na_trap.into_sexp(); // R double (not NA_integer_!)Source§impl IntoR for isize
Convert isize to R integer (INTSXP) or numeric (REALSXP).
impl IntoR for isize
Convert isize to R integer (INTSXP) or numeric (REALSXP).
On 64-bit platforms, uses the same smart conversion as i64(impl IntoR for i64).
On 32-bit platforms, isize fits in i32 so conversion is always exact.
Source§impl IntoR for u64
Convert u64 to R integer (INTSXP) or numeric (REALSXP).
impl IntoR for u64
Convert u64 to R integer (INTSXP) or numeric (REALSXP).
Values in [0, i32::MAX] are returned as R integers. Larger values
fall back to R doubles (which may lose precision above 2^53).
Source§impl IntoR for usize
Convert usize to R integer (INTSXP) or numeric (REALSXP).
impl IntoR for usize
Convert usize to R integer (INTSXP) or numeric (REALSXP).
Values in [0, i32::MAX] are returned as R integers. Larger values
fall back to R doubles.
Source§impl<'a, T> IntoR for Option<&'a [T]>
Convert Option<&[T]> to R as the slice converts: Some → the R vector
&[T] produces, None → NULL.
impl<'a, T> IntoR for Option<&'a [T]>
Convert Option<&[T]> to R as the slice converts: Some → the R vector
&[T] produces, None → NULL.
Source§impl<'a, T> IntoR for Vec<&'a [T]>
Convert Vec<&[T]> to an R list of vectors (VECSXP), for every T with a
&[T]: IntoR conversion.
impl<'a, T> IntoR for Vec<&'a [T]>
Convert Vec<&[T]> to an R list of vectors (VECSXP), for every T with a
&[T]: IntoR conversion.
Borrowed analogue of Vec<Vec<T>> — each slice is copied into a fresh R
vector of the type &[T] (and Vec<T>) produces.
Source§impl<'a, T> IntoR for Vec<Option<&'a [T]>>
Convert Vec<Option<&[T]>> to an R list where None → NULL and
Some(s) → the R vector &[T] produces, for every T with a
&[T]: IntoR conversion.
impl<'a, T> IntoR for Vec<Option<&'a [T]>>
Convert Vec<Option<&[T]>> to an R list where None → NULL and
Some(s) → the R vector &[T] produces, for every T with a
&[T]: IntoR conversion.
Borrowed analogue of Vec<Option<Vec<T>>> — each slice is copied into a fresh R vector.
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR, L: IntoR> IntoR for (A, B, C, D, E, F, G, H, I, J, K, L)
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR, L: IntoR> IntoR for (A, B, C, D, E, F, G, H, I, J, K, L)
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR, L: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H, I, J, K, L)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR, L: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H, I, J, K, L)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR, L: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H, I, J, K, L)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR, L: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H, I, J, K, L)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR, L: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H, I, J, K, L)>>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR, L: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H, I, J, K, L)>>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR> IntoR for (A, B, C, D, E, F, G, H, I, J, K)
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR> IntoR for (A, B, C, D, E, F, G, H, I, J, K)
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H, I, J, K)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H, I, J, K)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H, I, J, K)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H, I, J, K)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H, I, J, K)>>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR, K: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H, I, J, K)>>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR> IntoR for (A, B, C, D, E, F, G, H, I, J)
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR> IntoR for (A, B, C, D, E, F, G, H, I, J)
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H, I, J)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H, I, J)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H, I, J)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H, I, J)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H, I, J)>>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR, J: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H, I, J)>>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR> IntoR for (A, B, C, D, E, F, G, H, I)
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR> IntoR for (A, B, C, D, E, F, G, H, I)
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H, I)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H, I)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H, I)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H, I)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H, I)>>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR, I: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H, I)>>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR> IntoR for (A, B, C, D, E, F, G, H)
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR> IntoR for (A, B, C, D, E, F, G, H)
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR> IntoR for Option<(A, B, C, D, E, F, G, H)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR> IntoR for Vec<(A, B, C, D, E, F, G, H)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H)>>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR, H: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G, H)>>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR> IntoR for (A, B, C, D, E, F, G)
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR> IntoR for (A, B, C, D, E, F, G)
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR> IntoR for Option<(A, B, C, D, E, F, G)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR> IntoR for Option<(A, B, C, D, E, F, G)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR> IntoR for Vec<(A, B, C, D, E, F, G)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR> IntoR for Vec<(A, B, C, D, E, F, G)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G)>>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR, G: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F, G)>>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR> IntoR for (A, B, C, D, E, F)
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR> IntoR for (A, B, C, D, E, F)
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR> IntoR for Option<(A, B, C, D, E, F)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR> IntoR for Option<(A, B, C, D, E, F)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR> IntoR for Vec<(A, B, C, D, E, F)>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR> IntoR for Vec<(A, B, C, D, E, F)>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F)>>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR, F: IntoR> IntoR for Vec<Option<(A, B, C, D, E, F)>>
Source§impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR> IntoR for Vec<Option<(A, B, C, D, E)>>
impl<A: IntoR, B: IntoR, C: IntoR, D: IntoR, E: IntoR> IntoR for Vec<Option<(A, B, C, D, E)>>
Source§impl<T, E, const N: usize> IntoR for [T; N]
Convert a fixed-size array through its borrowed slice conversion.
impl<T, E, const N: usize> IntoR for [T; N]
Convert a fixed-size array through its borrowed slice conversion.
Native values, smart integers, strings and logicals keep the slice’s R
representation and error type, without allocating an intermediate Vec.
Source§impl<T, E> IntoR for Result<T, E>
Convert Result<T, E> to R (value-style, for #[miniextendr(unwrap_in_r)]).
impl<T, E> IntoR for Result<T, E>
Convert Result<T, E> to R (value-style, for #[miniextendr(unwrap_in_r)]).
§Behavior
Ok(value)→ returns the converted value directlyErr(msg)→ returnslist(error = "<msg>")(value-style error)
§When This Is Used
This impl is only used when #[miniextendr(unwrap_in_r)] is specified.
Without that attribute, #[miniextendr] functions returning Result<T, E>
will unwrap in Rust and raise an R error on Err (error boundary semantics).
§Error Handling Summary
| Mode | On Err(e) | Bound Required |
|---|---|---|
| Default | R error via panic | E: Debug |
unwrap_in_r | list(error = ...) | E: Display |
Default (without unwrap_in_r): Result<T, E> acts as an error boundary:
Ok(v)→vconverted to RErr(e)→ R error with Debug-formatted message (requiresE: Debug)
With unwrap_in_r: Result<T, E> is passed through to R:
Ok(v)→vconverted to RErr(e)→list(error = e.to_string())(requiresE: Display)
Exception: Result<T, ()> never reaches this impl in either mode —
the macro rewrites it to Result<T, NullOnErr> before the unwrap_in_r
check, and Err(()) returns NULL. See NullOnErr.
§Example
// Default: error boundary - Err becomes R stop()
#[miniextendr]
fn divide(x: f64, y: f64) -> Result<f64, String> {
if y == 0.0 { Err("division by zero".into()) }
else { Ok(x / y) }
}
// In R: tryCatch(divide(1, 0), error = ...) catches the error
// Value-style: Err becomes list(error = ...)
#[miniextendr(unwrap_in_r)]
fn divide_safe(x: f64, y: f64) -> Result<f64, String> {
if y == 0.0 { Err("division by zero".into()) }
else { Ok(x / y) }
}
// In R: result <- divide_safe(1, 0)
// if (!is.null(result$error)) { handle error }Source§impl<T, const N: usize> IntoR for Option<[T; N]>
Convert an optional array: Some uses the array conversion, None is NULL.
impl<T, const N: usize> IntoR for Option<[T; N]>
Convert an optional array: Some uses the array conversion, None is NULL.
Source§impl<T, const N: usize> IntoR for Vec<[T; N]>
Convert Vec<[T; N]> to an R list of vectors, for every T with a
Vec<T>: IntoR conversion. Each array becomes the R vector its Vec<T>
would.
impl<T, const N: usize> IntoR for Vec<[T; N]>
Convert Vec<[T; N]> to an R list of vectors, for every T with a
Vec<T>: IntoR conversion. Each array becomes the R vector its Vec<T>
would.
Source§impl<T: ?Sized> IntoR for Box<Altrep<T>>
A boxed unsized marker uses the same owned backend as Altrep<Box<T>>.
impl<T: ?Sized> IntoR for Box<Altrep<T>>
A boxed unsized marker uses the same owned backend as Altrep<Box<T>>.
Source§impl<T: IntoR> IntoR for Result<T, NullOnErr>
Convert Result<T, NullOnErr> to R, returning NULL on error.
impl<T: IntoR> IntoR for Result<T, NullOnErr>
Convert Result<T, NullOnErr> to R, returning NULL on error.
This is a special case for Result<T, ()> types where the error
carries no information. Instead of raising an R error, we return NULL.
Fires whenever the error type is (), independent of
#[miniextendr(unwrap_in_r)].
Source§impl<T: IntoRVecElement> IntoR for Vec<T>
The single IntoR for Vec<T> blanket, shared by MatchArg enums and
#[derive(IntoR)] newtypes via IntoRVecElement. Coexists with the
concrete impl IntoR for Vec<i32> (etc.) impls: IntoRVecElement is
crate-local, so coherence proves the foreign R-native types do not implement
it.
impl<T: IntoRVecElement> IntoR for Vec<T>
The single IntoR for Vec<T> blanket, shared by MatchArg enums and
#[derive(IntoR)] newtypes via IntoRVecElement. Coexists with the
concrete impl IntoR for Vec<i32> (etc.) impls: IntoRVecElement is
crate-local, so coherence proves the foreign R-native types do not implement
it.
Source§impl<T: RNativeType + Eq + Hash> IntoR for Option<HashSet<T>>
Convert Option<HashSet<T>> to R: Some(set) -> vector, None -> NULL.
impl<T: RNativeType + Eq + Hash> IntoR for Option<HashSet<T>>
Convert Option<HashSet<T>> to R: Some(set) -> vector, None -> NULL.
Source§impl<T: RNativeType + Eq + Hash> IntoR for Vec<Option<HashSet<T>>>
Convert Vec<Option<HashSet<T>>> to R list where None → NULL, Some(s) → unordered vector.
impl<T: RNativeType + Eq + Hash> IntoR for Vec<Option<HashSet<T>>>
Convert Vec<Option<HashSet<T>>> to R list where None → NULL, Some(s) → unordered vector.
Source§impl<T: RNativeType + Ord> IntoR for Option<BTreeSet<T>>
Convert Option<BTreeSet<T>> to R: Some(set) -> vector, None -> NULL.
impl<T: RNativeType + Ord> IntoR for Option<BTreeSet<T>>
Convert Option<BTreeSet<T>> to R: Some(set) -> vector, None -> NULL.
Source§impl<T: RNativeType + Ord> IntoR for Vec<Option<BTreeSet<T>>>
Convert Vec<Option<BTreeSet<T>>> to R list where None → NULL, Some(s) → sorted vector.
impl<T: RNativeType + Ord> IntoR for Vec<Option<BTreeSet<T>>>
Convert Vec<Option<BTreeSet<T>>> to R list where None → NULL, Some(s) → sorted vector.
Source§impl<T: RNativeType> IntoR for Vec<BTreeSet<T>>
Convert Vec<BTreeSet<T>> to R list of vectors (for RNativeType elements).
Each BTreeSet becomes an R vector (sorted).
impl<T: RNativeType> IntoR for Vec<BTreeSet<T>>
Convert Vec<BTreeSet<T>> to R list of vectors (for RNativeType elements).
Each BTreeSet becomes an R vector (sorted).
Source§impl<T: RNativeType> IntoR for Vec<HashSet<T>>
Convert Vec<HashSet<T>> to R list of vectors (for RNativeType elements).
Each HashSet becomes an R vector (unordered).
impl<T: RNativeType> IntoR for Vec<HashSet<T>>
Convert Vec<HashSet<T>> to R list of vectors (for RNativeType elements).
Each HashSet becomes an R vector (unordered).
Source§impl<T: TypedExternal> IntoR for Option<ExternalPtr<T>>
Convert Option<ExternalPtr<T>> to R: Some → the external pointer,
None → NULL, as a Vec<Option<ExternalPtr<T>>> element converts.
impl<T: TypedExternal> IntoR for Option<ExternalPtr<T>>
Convert Option<ExternalPtr<T>> to R: Some → the external pointer,
None → NULL, as a Vec<Option<ExternalPtr<T>>> element converts.
Source§impl<T: TypedExternal> IntoR for Vec<ExternalPtr<T>>
Build an R list (VECSXP) of external pointers from Vec<ExternalPtr<T>>.
impl<T: TypedExternal> IntoR for Vec<ExternalPtr<T>>
Build an R list (VECSXP) of external pointers from Vec<ExternalPtr<T>>.
Each element EXTPTRSXP is rooted in the process-wide
ProtectPool for the lifetime of its ExternalPtr
handle (#836/#841), so holding them in a Vec is GC-safe and laying them
into a freshly allocated list needs no extra protection — see
vec_externalptr_to_list.
Source§impl<T: TypedExternal> IntoR for Vec<Option<ExternalPtr<T>>>
Build an R list (VECSXP) from Vec<Option<ExternalPtr<T>>>, with None
mapping to NULL and Some(ptr) to the external pointer (issue #827).
impl<T: TypedExternal> IntoR for Vec<Option<ExternalPtr<T>>>
Build an R list (VECSXP) from Vec<Option<ExternalPtr<T>>>, with None
mapping to NULL and Some(ptr) to the external pointer (issue #827).
Source§impl<T> IntoR for &[T]where
T: RNativeType,
impl<T> IntoR for &[T]where
T: RNativeType,
Source§impl<T> IntoR for BinaryHeap<T>where
T: RNativeType + Ord,
Convert BinaryHeap<T> to R vector where T: RNativeType + Ord.
impl<T> IntoR for BinaryHeap<T>where
T: RNativeType + Ord,
Convert BinaryHeap<T> to R vector where T: RNativeType + Ord.
The heap is drained into a vector (destroying the heap property). Elements are returned in arbitrary order, not sorted.
Source§impl<T> IntoR for Cow<'_, [T]>where
T: RNativeType + Clone,
Convert Cow<'_, [T]> to R vector where T: RNativeType.
impl<T> IntoR for Cow<'_, [T]>where
T: RNativeType + Clone,
Convert Cow<'_, [T]> to R vector where T: RNativeType.
Always copies into a fresh R vector via the &[T] path. We deliberately do
not attempt speculative SEXP pointer recovery on the Cow::Borrowed arm:
a bare &[T] carries no provenance metadata, so a borrowed sub-slice of
an R vector (e.g. &cow[2..5]) is indistinguishable from a full borrow by
pointer + length alone. Probing data_ptr − header for such a sub-slice
reads provenance-free memory off the start of the R vector — the same hazard
removed from the Arrow path in #867 (see #880). The Arrow Buffer can prove
it is R-backed (ptr_offset/capacity); a &[T] cannot, so the only sound
choice is the always-correct copy. Cow remains zero-copy on the input
side through TryFromRoot and generated wrappers; raw TryFromSexp
returns owned data. IntoR always copies.
Source§impl<T> IntoR for Option<&T>
Convert Option<&T> to R SEXP by copying the value.
impl<T> IntoR for Option<&T>
Convert Option<&T> to R SEXP by copying the value.
Some(&v)→ copiesvand converts to RNone→ returnsNULL(R_NilValue)
Note: This returns NULL for None, not NA, since there’s no reference to return.
Use Option<T> directly if you want NA semantics for scalar types.
T: Copy excludes str (unsized), so Option<&str> does not go
through this impl — see the dedicated Option<&str> impl above, which
returns NA_character_ instead of NULL.
Source§impl<T> IntoR for Option<Box<[T]>>
Convert Option<Box<[T]>> to R exactly as Option<Vec<T>> (into_vec()
is an O(1) widen): Some → the R vector Vec<T> produces, None → NULL.
impl<T> IntoR for Option<Box<[T]>>
Convert Option<Box<[T]>> to R exactly as Option<Vec<T>> (into_vec()
is an O(1) widen): Some → the R vector Vec<T> produces, None → NULL.
Source§impl<T> IntoR for Option<Vec<T>>
Convert Option<Vec<T>> to R: Some(vec) → the R vector Vec<T>
produces, None → NULL, for every T with a Vec<T>: IntoR conversion.
impl<T> IntoR for Option<Vec<T>>
Convert Option<Vec<T>> to R: Some(vec) → the R vector Vec<T>
produces, None → NULL, for every T with a Vec<T>: IntoR conversion.
Source§impl<T> IntoR for Vec<Box<[T]>>
Convert Vec<Box<[T]>> to an R list of vectors, for every T with a
Vec<T>: IntoR conversion. Each boxed slice becomes the R vector its
Vec<T> would (into_vec() is an O(1) widen).
impl<T> IntoR for Vec<Box<[T]>>
Convert Vec<Box<[T]>> to an R list of vectors, for every T with a
Vec<T>: IntoR conversion. Each boxed slice becomes the R vector its
Vec<T> would (into_vec() is an O(1) widen).
Source§impl<T> IntoR for Vec<Option<Box<[T]>>>
Convert Vec<Option<Box<[T]>>> exactly as Vec<Option<Vec<T>>> (each
into_vec() is an O(1) widen). The enum DataFrameRow companion stores an
opaque Box<[T]> variant field in this shape.
impl<T> IntoR for Vec<Option<Box<[T]>>>
Convert Vec<Option<Box<[T]>>> exactly as Vec<Option<Vec<T>>> (each
into_vec() is an O(1) widen). The enum DataFrameRow companion stores an
opaque Box<[T]> variant field in this shape.
Source§impl<T> IntoR for Vec<Option<Vec<T>>>
Convert Vec<Option<Vec<T>>> to an R list where None → NULL and
Some(v) → the R vector Vec<T> produces, for every T with a
Vec<T>: IntoR conversion.
impl<T> IntoR for Vec<Option<Vec<T>>>
Convert Vec<Option<Vec<T>>> to an R list where None → NULL and
Some(v) → the R vector Vec<T> produces, for every T with a
Vec<T>: IntoR conversion.
Source§impl<T> IntoR for Vec<Vec<T>>
Convert Vec<Vec<T>> to an R list of vectors (VECSXP), for every T with
a Vec<T>: IntoR conversion. Each row is converted by that impl, so it has
the R type Vec<T> produces (for usize / u64 / i64 / isize / u32:
integer when every value fits, else double, decided per row).
impl<T> IntoR for Vec<Vec<T>>
Convert Vec<Vec<T>> to an R list of vectors (VECSXP), for every T with
a Vec<T>: IntoR conversion. Each row is converted by that impl, so it has
the R type Vec<T> produces (for usize / u64 / i64 / isize / u32:
integer when every value fits, else double, decided per row).
Source§impl<T> IntoR for VecDeque<T>where
T: RNativeType,
Convert VecDeque<T> to R vector where T: RNativeType.
impl<T> IntoR for VecDeque<T>where
T: RNativeType,
Convert VecDeque<T> to R vector where T: RNativeType.
Source§impl<V: IntoR> IntoR for BTreeMap<String, V>
Convert BTreeMap<String, V> to R named list (VECSXP).
impl<V: IntoR> IntoR for BTreeMap<String, V>
Convert BTreeMap<String, V> to R named list (VECSXP).
Source§impl<V: IntoR> IntoR for HashMap<String, V>
Convert HashMap<String, V> to R named list (VECSXP).
impl<V: IntoR> IntoR for HashMap<String, V>
Convert HashMap<String, V> to R named list (VECSXP).
Source§impl<V: IntoR> IntoR for Option<BTreeMap<String, V>>
Convert Option<BTreeMap<String, V>> to R: Some(map) -> named list, None -> NULL.
impl<V: IntoR> IntoR for Option<BTreeMap<String, V>>
Convert Option<BTreeMap<String, V>> to R: Some(map) -> named list, None -> NULL.
Source§impl<V: IntoR> IntoR for Option<HashMap<String, V>>
Convert Option<HashMap<String, V>> to R: Some(map) -> named list, None -> NULL.
impl<V: IntoR> IntoR for Option<HashMap<String, V>>
Convert Option<HashMap<String, V>> to R: Some(map) -> named list, None -> NULL.
Source§impl<V: IntoR> IntoR for Vec<BTreeMap<String, V>>
Convert Vec<BTreeMap<String, V>> to R list of named lists.
impl<V: IntoR> IntoR for Vec<BTreeMap<String, V>>
Convert Vec<BTreeMap<String, V>> to R list of named lists.
Source§impl<V: IntoR> IntoR for Vec<HashMap<String, V>>
Convert Vec<HashMap<String, V>> to R list of named lists.
impl<V: IntoR> IntoR for Vec<HashMap<String, V>>
Convert Vec<HashMap<String, V>> to R list of named lists.
Source§impl<V: IntoR> IntoR for Vec<Option<BTreeMap<String, V>>>
Convert Vec<Option<BTreeMap<String, V>>> to R list where None → NULL, Some(m) → named list.
impl<V: IntoR> IntoR for Vec<Option<BTreeMap<String, V>>>
Convert Vec<Option<BTreeMap<String, V>>> to R list where None → NULL, Some(m) → named list.
Source§impl<V: IntoR> IntoR for Vec<Option<HashMap<String, V>>>
Convert Vec<Option<HashMap<String, V>>> to R list where None → NULL, Some(m) → named list.
impl<V: IntoR> IntoR for Vec<Option<HashMap<String, V>>>
Convert Vec<Option<HashMap<String, V>>> to R list where None → NULL, Some(m) → named list.
Implementors§
Source§impl IntoR for AltrepSexp
Convert AltrepSexp to R by returning the inner SEXP.
impl IntoR for AltrepSexp
Convert AltrepSexp to R by returning the inner SEXP.
This allows AltrepSexp to be used as a return type from #[miniextendr]
functions, transparently passing the ALTREP SEXP back to R.
Source§impl IntoR for BuiltDataFrame
Releases the root and hands the frame over, unprotected, as
DataFrame::as_sexp / IntoR::into_sexp do: the caller (typically the
.Call return path) takes over protection. R_ReleaseObject does not
allocate, so no GC can run between the release and the return.
impl IntoR for BuiltDataFrame
Releases the root and hands the frame over, unprotected, as
DataFrame::as_sexp / IntoR::into_sexp do: the caller (typically the
.Call return path) takes over protection. R_ReleaseObject does not
allocate, so no GC can run between the release and the return.
Source§impl IntoR for NArgs
The count as an R integer, for a #[miniextendr] trait’s method that takes
an NArgs parameter (its view passes each argument to the vtable as a
SEXP).
impl IntoR for NArgs
The count as an R integer, for a #[miniextendr] trait’s method that takes
an NArgs parameter (its view passes each argument to the vtable as a
SEXP).
Source§impl<I, T> IntoR for Collect<I>where
I: ExactSizeIterator<Item = T>,
T: RNativeType,
impl<I, T> IntoR for Collect<I>where
I: ExactSizeIterator<Item = T>,
T: RNativeType,
Source§impl<I> IntoR for CollectNAInt<I>
impl<I> IntoR for CollectNAInt<I>
Source§impl<I> IntoR for CollectStrings<I>where
I: ExactSizeIterator<Item = String>,
impl<I> IntoR for CollectStrings<I>where
I: ExactSizeIterator<Item = String>,
Source§impl<K: AsRef<str>, V: AtomicElement, const N: usize> IntoR for AsNamedVector<[(K, V); N]>
impl<K: AsRef<str>, V: AtomicElement, const N: usize> IntoR for AsNamedVector<[(K, V); N]>
Source§impl<K: AsRef<str>, V: AtomicElement> IntoR for AsNamedVector<Vec<(K, V)>>
impl<K: AsRef<str>, V: AtomicElement> IntoR for AsNamedVector<Vec<(K, V)>>
Source§impl<K: AsRef<str>, V: Clone + AtomicElement> IntoR for AsNamedVector<&[(K, V)]>
impl<K: AsRef<str>, V: Clone + AtomicElement> IntoR for AsNamedVector<&[(K, V)]>
Source§impl<T: Display> IntoR for AsFromStr<T>
The value’s Display text as a character scalar, which the marker parses
back. A trait’s View passes an AsFromStr argument this way, so the value
crosses unchanged when T::from_str(&t.to_string()) == t (the std
numbers, IpAddr, Uuid, …). This IntoR exists for the trait ABI; to
return text from a function, use AsDisplay.
impl<T: Display> IntoR for AsFromStr<T>
The value’s Display text as a character scalar, which the marker parses
back. A trait’s View passes an AsFromStr argument this way, so the value
crosses unchanged when T::from_str(&t.to_string()) == t (the std
numbers, IpAddr, Uuid, …). This IntoR exists for the trait ABI; to
return text from a function, use AsDisplay.
Source§impl<T: Display> IntoR for AsFromStrVec<T>
Each value’s Display text as a character vector, which the marker parses
back element by element (see AsFromStr’s IntoR).
impl<T: Display> IntoR for AsFromStrVec<T>
Each value’s Display text as a character vector, which the marker parses
back element by element (see AsFromStr’s IntoR).
Source§impl<T: IntoDataFrame> IntoR for AsDataFrame<T>
impl<T: IntoDataFrame> IntoR for AsDataFrame<T>
type Error = DataFrameError
Source§impl<T: IntoExternalPtr> IntoR for AsExternalPtr<T>
impl<T: IntoExternalPtr> IntoR for AsExternalPtr<T>
Source§impl<T: IntoExternalPtr> IntoR for T
Blanket impl: Types marked with IntoExternalPtr get automatic IntoR.
impl<T: IntoExternalPtr> IntoR for T
Blanket impl: Types marked with IntoExternalPtr get automatic IntoR.
This wraps the value in ExternalPtr<T> automatically, so you can return
MyType directly from #[miniextendr] functions instead of ExternalPtr<MyType>.
Source§impl<T: IntoR> IntoR for Invisible<T>
Forwards to T: the marker only informs the generated R wrapper.
impl<T: IntoR> IntoR for Invisible<T>
Forwards to T: the marker only informs the generated R wrapper.
Source§impl<T: IntoR> IntoR for Visible<T>
Forwards to T: the marker only informs the generated R wrapper.
impl<T: IntoR> IntoR for Visible<T>
Forwards to T: the marker only informs the generated R wrapper.
Source§impl<T: RNativeType> IntoR for RCow<'_, T>
Returns the source SEXP unchanged for the borrowed arm (true zero-copy), or
materializes a fresh R vector for the owned arm.
impl<T: RNativeType> IntoR for RCow<'_, T>
Returns the source SEXP unchanged for the borrowed arm (true zero-copy), or materializes a fresh R vector for the owned arm.
Source§impl<T: TypedExternal> IntoR for ExternalPtr<T>
impl<T: TypedExternal> IntoR for ExternalPtr<T>
Source§impl<T: UnitEnumFactor> IntoR for FactorOptionVec<T>
impl<T: UnitEnumFactor> IntoR for FactorOptionVec<T>
Source§impl<T> IntoR for Altrep<T>where
T: RegisterAltrep + TypedExternal,
Convert Altrep<T> to R using ALTREP representation.
impl<T> IntoR for Altrep<T>where
T: RegisterAltrep + TypedExternal,
Convert Altrep<T> to R using ALTREP representation.
This creates an ALTREP object where the data stays in Rust and is provided to R on-demand through ALTREP callbacks.