Skip to main content

TryFromSexp

Trait TryFromSexp 

Source
pub trait TryFromSexp: Sized {
    type Error;

    const NATIVE_BORROW: Option<NativeBorrow> = None;
    const CHARACTER_ONLY: bool = false;
#[doc(hidden)]
const __MX_EXPECTATION: Option<&'static str> = None; // Required method fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>; // Provided methods unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error> { ... }
#[doc(hidden)]
unsafe fn __mx_try_from_rooted(root: Root<'_>) -> Result<Self, Self::Error> { ... }
#[doc(hidden)]
fn __mx_has_na(&self) -> bool { ... }
#[doc(hidden)]
fn __mx_input_has_na(&self, input: SEXP) -> bool { ... }
#[doc(hidden)]
fn __mx_try_from_sexp_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError> where Self::Error: Into<SexpError> { ... }
#[doc(hidden)]
unsafe fn __mx_try_from_sexp_unchecked_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError> where Self::Error: Into<SexpError> { ... } }
Expand description

TryFrom-style trait for converting SEXP to Rust types.

Inbound counterpart of crate::into_r::IntoR. Strict by construction (returns Result) — for a looser, multi-source coercion path use crate::coerce::Coerce / crate::coerce::TryCoerce.

§Examples

use miniextendr_api::SEXP;
use miniextendr_api::from_r::TryFromSexp;

fn example(sexp: SEXP) {
    let value: i32 = TryFromSexp::try_from_sexp(sexp).unwrap();
    let text: String = TryFromSexp::try_from_sexp(sexp).unwrap();
}

Provided Associated Constants§

Source

const NATIVE_BORROW: Option<NativeBorrow> = None

Native vector storage retained by this conversion, if any.

Generated wrappers use this before conversion to reject aliased mutable borrows. Owned and custom object conversions default to no native borrow. Conversions that retain native references must describe their leaf and forward this metadata through their containers.

Source

const CHARACTER_ONLY: bool = false

Whether this conversion accepts only character input: every value it converts, other than NULL, is a character vector or a factor.

#[miniextendr] reads it for choice parameters (match_arg / choices) typed Either<T, R>. Their R wrapper sends all character and factor input to the choice T, so an R with CHARACTER_ONLY = true could receive at most NULL, and the macro rejects the signature at compile time.

Defaults to false, which is always safe: the check is skipped. Set it to true in an implementation that reads only strings or factors, and forward it (<Inner as TryFromSexp>::CHARACTER_ONLY) in one that delegates to another conversion. Do not set it on a type that also converts numbers, logicals or lists: that would reject valid parameters.

The built-in string and factor conversions (including the types given try_from_sexp_via_str_parse!, such as uuid, url, regex and num-bigint), #[derive(MatchArg)] and #[derive(RFactor)] set it. Option<T>, Vec<T>, Box<[T]>, Missing<T> and #[derive(TryFromSexp)] newtypes forward it. AsCharacter leaves it false, since it also converts numbers.

§Examples
use miniextendr_api::SEXP;
use miniextendr_api::from_r::{SexpError, TryFromSexp};

pub struct Username(String);

impl TryFromSexp for Username {
    type Error = SexpError;
    const CHARACTER_ONLY: bool = <String as TryFromSexp>::CHARACTER_ONLY;

    fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error> {
        String::try_from_sexp(sexp).map(Username)
    }
}
Source

#[doc(hidden)]
const __MX_EXPECTATION: Option<&'static str> = None

What an argument of this type must be, in R terms, when #[miniextendr] cannot tell from the type as written: the <expected> of a failed conversion’s '<p>' must be <expected>: ....

#[derive(TryFromSexp)] sets it from the newtype’s inner type (struct Dose(AsNumeric) says a single number, as AsNumeric does) or forwards the inner type’s. The generated wrapper reads it on the failure path of a parameter whose type the macro does not know, alone or as an arm of an Either. None (the default) leaves the expectation to the conversion error, else invalid '<p>' argument.

Required Associated Types§

Source

type Error

The error type returned when conversion fails.

Required Methods§

Source

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Attempt to convert an R SEXP to this Rust type.

In debug builds, may assert that we’re on R’s main thread.

Provided Methods§

Source

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Convert from SEXP without thread safety checks.

§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.

Source

#[doc(hidden)]
unsafe fn __mx_try_from_rooted(root: Root<'_>) -> Result<Self, Self::Error>

Convert with a scope able to retain uncached ALTREP elements. Custom reference converters keep their existing behavior by default.

§Safety

R’s main thread. Any R-backed references in the result must be narrowed to the lifetime of root; this hook does not change Self’s lifetime.

Source

#[doc(hidden)]
fn __mx_has_na(&self) -> bool

Whether the converted argument holds a value #[miniextendr(no_na)] refuses after the conversion.

The default is false, because no_na’s R guard (!anyNA(x)) already refuses R’s NA before the conversion runs. The reading markers (AsNumeric*, AsCharacter*) override it: they read more inputs as missing than anyNA() sees (the text "NA", blank strings, a factor NA level, …). The layers a marker can sit in (Option, Missing, the named-list maps, Result<T, ()>, Either, #[derive(TryFromSexp)] newtypes) forward it, so a type alias or a newtype of a marker is checked too. The generated C wrapper calls it on the value of every no_na parameter that has the R guard.

Source

#[doc(hidden)]
fn __mx_input_has_na(&self, input: SEXP) -> bool

Whether #[miniextendr(no_na)] refuses this converted argument, read from input (the R value it converted from), when no R guard ran.

An Either parameter gets no !anyNA(x) guard: one test on the whole argument is wrong for an arm with its own reading of NA, such as a data frame whose cells may be missing. Its C wrapper calls this instead of __mx_has_na. The default makes the guard’s check in Rust (R’s anyNA(input)), then asks __mx_has_na for what a marker reads as NA beyond it. Either asks the arm the value converted to, Missing asks its value, and DataFrame refuses nothing, so the NA cells of a data frame arm get through. The wrappers Result<T, ()>, Option<DataFrame>, Option<Either<L, R>> and #[derive(TryFromSexp)] newtypes ask their value too, so a Result<DataFrame, ()> or Option<DataFrame> arm, a newtype of a DataFrame, or the data frame arm of an Option<Either<..>> keeps its NA cells as well. Their Err(()) / None comes only from NULL, which holds no NA, so it passes.

An Option arm over a scalar (Either<Option<AsNumeric>, DataFrame>) keeps the default, which reads the input rather than the value: NULL holds no NA and passes as None, while an NA the arm reads as None (Option<f64>, Option<String>) is still refused. An override that answered false for None would let that NA through; the overrides above can, since their None is never an NA.

Source

#[doc(hidden)]
fn __mx_try_from_sexp_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>
where Self::Error: Into<SexpError>,

Convert, running check, an element type’s TryFromSexpElement::check_sexp, on the R value that carries an element’s class (#1837).

The newtype containers read Vec<T> through Vec<T::Inner> and Vec<Option<T>> through Vec<Option<T::Inner>> with this, passing T::check_sexp, so the inner container decides where the check runs:

  • The default runs it once, on the whole input, then converts. An atomic vector carries its class on the vector.
  • A list of R objects runs it on each element instead, where each object carries its own class: Vec<List> on every element, Vec<Option<List>> on every element but NULL.
  • The newtype containers pass it on, with their own element’s check after it, so a newtype of a newtype checks outer then inner, as its scalar does.

An override must also override __mx_try_from_sexp_unchecked_with_check. Not public API.

Source

#[doc(hidden)]
unsafe fn __mx_try_from_sexp_unchecked_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>
where Self::Error: Into<SexpError>,

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl TryFromSexp for &'static str

Convert R character vector (STRSXP) to Rust &str.

Extracts the first element of the character vector and returns it as a UTF-8 string. The Rust type uses a static lifetime for API convenience, but the borrow is only valid while the source CHARSXP remains reachable.

§NA Handling

Warning: NA_character_ is converted to empty string "". This is lossy! If you need to distinguish between NA and empty strings, use Option<String> instead:

ⓘ
let maybe_str: Option<String> = sexp.try_into()?;

§Safety

The returned &str is only valid as long as R doesn’t garbage collect the CHARSXP. For ALTSTRING inputs, rooting the source alone may not retain its elements. Use TryFromRoot to retain uncached elements for the call’s scope.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn __mx_try_from_rooted(root: Root<'_>) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Arc<str>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<String>

Convert R character vector to BTreeSet<String>.

Source§

impl TryFromSexp for BTreeSet<bool>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<i8>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<i16>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<i32>

Source§

impl TryFromSexp for BTreeSet<i64>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<isize>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<u8>

Source§

impl TryFromSexp for BTreeSet<u16>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<u32>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<u64>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for BTreeSet<usize>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Box<str>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Cow<'_, str>

Convert an R character scalar to an owned Cow.

The same scalar/NA semantics as String. Borrowing requires super::TryFromRoot, which generated wrappers use for Cow<'_, str>.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<RLogical>

Source§

impl TryFromSexp for HashSet<String>

Convert R character vector to HashSet<String>.

Source§

impl TryFromSexp for HashSet<bool>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<i8>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<i16>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<i32>

Source§

impl TryFromSexp for HashSet<i64>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<isize>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<u8>

Source§

impl TryFromSexp for HashSet<u16>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<u32>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<u64>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for HashSet<usize>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<&'static str>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn __mx_try_from_rooted(root: Root<'_>) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<Arc<str>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<AsCharacter>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <AsCharacter as crate::from_r::TryFromSexp>::NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <AsCharacter as crate::from_r::TryFromSexp>::CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<AsCharacterVec>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <AsCharacterVec as crate::from_r::TryFromSexp>::NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <AsCharacterVec as crate::from_r::TryFromSexp>::CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<AsNumeric>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <AsNumeric as crate::from_r::TryFromSexp>::NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <AsNumeric as crate::from_r::TryFromSexp>::CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<AsNumericVec>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <AsNumericVec as crate::from_r::TryFromSexp>::NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <AsNumericVec as crate::from_r::TryFromSexp>::CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<Box<str>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<DataFrame>

NULL → None; any other value converts as a DataFrame (same view, attributes and NA cells, same error) and becomes Some.

Concrete rather than left to the newtype blanket Option<T> impl (newtype.rs), which DataFrame does not match: without this impl, Option<DataFrame>: TryFromSexp fails with E0275 (overflow) instead of converting.

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <DataFrame as TryFromSexp>::NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <DataFrame as TryFromSexp>::CHARACTER_ONLY

Source§

type Error = <DataFrame as TryFromSexp>::Error

Source§

fn __mx_has_na(&self) -> bool

Source§

fn __mx_input_has_na(&self, input: SEXP) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<List>

Source§

impl TryFromSexp for Option<ListMut>

Source§

impl TryFromSexp for Option<NamedList>

Source§

impl TryFromSexp for Option<OsString>

NA-aware OsString conversion: returns None for NA_character_ or NULL.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<PathBuf>

NA-aware PathBuf conversion: returns None for NA_character_ or NULL.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<RLogical>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<Rboolean>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<Rc<str>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<Rcomplex>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<SEXP>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<String>

NA-aware string conversion: returns None for NA_character_.

Use this when you need to distinguish between NA and empty strings:

ⓘ
let maybe_str: Option<String> = sexp.try_into()?;
match maybe_str {
    Some(s) => println!("Got string: {}", s),
    None => println!("Got NA"),
}
Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<bool>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<f32>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<f64>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<i8>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<i16>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<i32>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<i64>

Convert R numeric scalar to Option<i64>, with NA → None.

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<isize>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<u8>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<u16>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<u32>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<u64>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Option<usize>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for OsString

Convert R character scalar (STRSXP of length 1) to OsString.

Since R strings are converted to UTF-8, the resulting OsString contains valid UTF-8 data.

§NA Handling

Warning: NA_character_ is converted to empty string. This is lossy! If you need to distinguish between NA and empty strings, use Option<OsString> instead.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for PathBuf

Convert R character scalar (STRSXP of length 1) to PathBuf.

§NA Handling

Warning: NA_character_ is converted to empty path "". This is lossy! If you need to distinguish between NA and empty strings, use Option<PathBuf> instead.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Rc<str>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for String

Convert R character vector (STRSXP) to owned Rust String.

Extracts the first element and creates an owned copy.

§NA Handling

Warning: NA_character_ is converted to empty string "". This is lossy! If you need to distinguish between NA and empty strings, use Option<String> instead:

ⓘ
let maybe_str: Option<String> = sexp.try_into()?;
Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<&'static str>

Convert R character vector to Vec<&str>.

Warning: NA_character_ values are converted to empty string "".

Source§

impl TryFromSexp for Vec<Arc<str>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Box<str>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Cow<'_, str>>

Convert a character vector to owned strings; NA becomes an empty string. Generated wrappers borrow instead through super::TryFromRoot.

Source§

impl TryFromSexp for Vec<List>

A list of lists (a list of R objects, such as model objects), read element by element (#1837).

The argument must be a list (VECSXP), and each element a list too. A pairlist is refused at either level, as for a List argument (#1866). Every element that fails is reported in one error, with its position as R counts it: expected list, got numeric (elements 2, 3). The elements stay rooted by the argument list.

A Vec of a #[derive(TryFromSexp)] newtype over List reads through this, and runs the newtype’s check (#[try_from_sexp(validate = ...)]) on each element, where each object keeps its class, not on the outer list.

Source§

fn __mx_try_from_sexp_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>

check runs on each element, before the element is read.

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn __mx_try_from_sexp_unchecked_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>

Source§

impl TryFromSexp for Vec<Logical>

Convert R logical vector (LGLSXP) to Vec<Logical> (ALTREP-compatible).

This converts R’s logical vector to a vector of Logical values, which is the native representation used by ALTREP logical vectors. Unlike Vec<bool>, this preserves NA values.

Source§

impl TryFromSexp for Vec<Option<&'static str>>

Convert R character vector to Vec<Option<&str>>.

Source§

impl TryFromSexp for Vec<Option<Arc<str>>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<Box<str>>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<Cow<'_, str>>>

Convert a character vector to owned strings, preserving NA as None. Generated wrappers borrow instead through super::TryFromRoot.

Source§

impl TryFromSexp for Vec<Option<List>>

A list of lists and NULLs, read element by element: a NULL element is None, any other element is read as for Vec<List>, with every failing element reported in one error.

For a Vec<Option<T>> of a newtype over List, the newtype’s check runs on each element but NULL, which stays “not given”, as for Option<T>.

Source§

fn __mx_try_from_sexp_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>

check runs on each element but NULL, before the element is read.

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn __mx_try_from_sexp_unchecked_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>

Source§

impl TryFromSexp for Vec<Option<OsString>>

Convert R character vector (STRSXP) to Vec<Option<OsString>> with NA support.

NA_character_ elements are converted to None.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<PathBuf>>

Convert R character vector (STRSXP) to Vec<Option<PathBuf>> with NA support.

NA_character_ elements are converted to None.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<RLogical>>

Convert R logical vector (LGLSXP) to Vec<Option<RLogical>> with NA support.

Source§

impl TryFromSexp for Vec<Option<Rboolean>>

Convert R logical vector (LGLSXP) to Vec<Option<Rboolean>> with NA support.

Source§

impl TryFromSexp for Vec<Option<Rc<str>>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<String>>

Convert R character vector (STRSXP) to Vec<Option<String>> with NA support.

NA_character_ elements are converted to None.

Source§

impl TryFromSexp for Vec<Option<bool>>

Convert R logical vector (LGLSXP) to Vec<Option<bool>> with NA support.

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<f32>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<f64>>

Source§

impl TryFromSexp for Vec<Option<i8>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<i16>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<i32>>

Source§

impl TryFromSexp for Vec<Option<i64>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<isize>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<u8>>

Convert R raw vector (RAWSXP) to Vec<Option<u8>>.

Source§

impl TryFromSexp for Vec<Option<u16>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<u32>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<u64>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Option<usize>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<OsString>

Convert R character vector (STRSXP) to Vec<OsString>.

§NA Handling

Warning: NA_character_ elements are converted to empty strings. Use Vec<Option<OsString>> if you need to preserve NA values.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<PathBuf>

Convert R character vector (STRSXP) to Vec<PathBuf>.

§NA Handling

Warning: NA_character_ elements are converted to empty paths. Use Vec<Option<PathBuf>> if you need to preserve NA values.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<RLogical>

Source§

impl TryFromSexp for Vec<Rboolean>

Convert R logical vector (LGLSXP) to Vec<Rboolean> (errors on NA).

Source§

impl TryFromSexp for Vec<Rc<str>>

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<Rcomplex>

Source§

impl TryFromSexp for Vec<String>

Convert R character vector to Vec<String>.

§NA and Encoding Handling

Warning: This conversion is lossy for NA values and encoding failures:

  • NA_character_ values are converted to empty string ""
  • Encoding translation failures become empty string ""
  • Invalid UTF-8 (after translation) becomes empty string ""

If you need to preserve NA semantics, use Vec<Option<String>> instead:

ⓘ
let strings: Vec<Option<String>> = sexp.try_into()?;
// NA values will be None, valid strings will be Some(s)

This design choice prioritizes convenience over strict correctness for the common case where strings are known to be non-NA and properly encoded.

Source§

impl TryFromSexp for Vec<bool>

Convert R logical vector (LGLSXP) to Vec<bool> (errors on NA).

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<f32>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<f64>

Source§

impl TryFromSexp for Vec<i8>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<i16>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<i32>

Source§

impl TryFromSexp for Vec<i64>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<isize>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<u8>

Source§

impl TryFromSexp for Vec<u16>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<u32>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<u64>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for Vec<usize>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for bool

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for char

Convert R character vector (STRSXP) to Rust char.

Extracts the first character of the first element of the character vector. Returns an error if the string is empty, NA, or has more than one character.

Source§

const CHARACTER_ONLY: bool = true

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for f32

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for f64

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for i8

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for i16

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for i32

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for i64

Convert R numeric scalar to i64.

§Behavior

  • Reads from REALSXP (f64) or INTSXP (i32)
  • Validates value is a whole number (no fractional part)
  • Validates value fits in i64 range
  • Returns Err for NA values

§Example

ⓘ
// From R integer
let val: i64 = TryFromSexp::try_from_sexp(int_sexp)?;

// From R numeric (must be whole number)
let val: i64 = TryFromSexp::try_from_sexp(real_sexp)?;

// Error: 3.14 is not a whole number
let val: Result<i64, _> = TryFromSexp::try_from_sexp(pi_sexp);
Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for isize

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for u8

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for u16

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for u32

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for u64

Convert R numeric scalar to u64.

Same behavior as i64(impl TryFromSexp for i64), but also validates the value is non-negative.

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl TryFromSexp for usize

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for &'a f64

Source§

impl<'a> TryFromSexp for &'a i32

Source§

impl<'a> TryFromSexp for &'a mut f64

§Safety note (aliasing)

This impl can produce aliased &mut references if the same R object is passed to multiple mutable parameters. The caller (generated wrapper) rejects overlapping native mutable/shared borrows before conversion. Direct conversion callers must enforce this borrowing contract themselves.

Source§

impl<'a> TryFromSexp for &'a mut i32

§Safety note (aliasing)

This impl can produce aliased &mut references if the same R object is passed to multiple mutable parameters. The caller (generated wrapper) rejects overlapping native mutable/shared borrows before conversion. Direct conversion callers must enforce this borrowing contract themselves.

Source§

impl<'a> TryFromSexp for &'a mut u8

§Safety note (aliasing)

This impl can produce aliased &mut references if the same R object is passed to multiple mutable parameters. The caller (generated wrapper) rejects overlapping native mutable/shared borrows before conversion. Direct conversion callers must enforce this borrowing contract themselves.

Source§

impl<'a> TryFromSexp for &'a u8

Source§

impl<'a> TryFromSexp for Option<&'a RLogical>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a RLogical as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a Rcomplex>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a crate::Rcomplex as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a f64>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a f64 as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a i32>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a i32 as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a mut RLogical>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a mut RLogical as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a mut Rcomplex>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a mut crate::Rcomplex as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a mut f64>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a mut f64 as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a mut i32>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a mut i32 as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a mut u8>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a mut u8 as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Option<&'a u8>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&'a u8 as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<'a> TryFromSexp for Vec<&'a RLogical>

Source§

impl<'a> TryFromSexp for Vec<&'a Rcomplex>

Source§

impl<'a> TryFromSexp for Vec<&'a [RLogical]>

Source§

impl<'a> TryFromSexp for Vec<&'a [Rcomplex]>

Source§

impl<'a> TryFromSexp for Vec<&'a [f64]>

Source§

impl<'a> TryFromSexp for Vec<&'a [i32]>

Source§

impl<'a> TryFromSexp for Vec<&'a [u8]>

Source§

impl<'a> TryFromSexp for Vec<&'a f64>

Source§

impl<'a> TryFromSexp for Vec<&'a i32>

Source§

impl<'a> TryFromSexp for Vec<&'a mut RLogical>

Source§

impl<'a> TryFromSexp for Vec<&'a mut Rcomplex>

Source§

impl<'a> TryFromSexp for Vec<&'a mut [RLogical]>

Source§

impl<'a> TryFromSexp for Vec<&'a mut [Rcomplex]>

Source§

impl<'a> TryFromSexp for Vec<&'a mut [f64]>

Source§

impl<'a> TryFromSexp for Vec<&'a mut [i32]>

Source§

impl<'a> TryFromSexp for Vec<&'a mut [u8]>

Source§

impl<'a> TryFromSexp for Vec<&'a mut f64>

Source§

impl<'a> TryFromSexp for Vec<&'a mut i32>

Source§

impl<'a> TryFromSexp for Vec<&'a mut u8>

Source§

impl<'a> TryFromSexp for Vec<&'a u8>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a RLogical>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a Rcomplex>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a [RLogical]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a [Rcomplex]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a [f64]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a [i32]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a [u8]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a f64>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a i32>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut RLogical>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut Rcomplex>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut [RLogical]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut [Rcomplex]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut [f64]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut [i32]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut [u8]>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut f64>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut i32>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a mut u8>>

Source§

impl<'a> TryFromSexp for Vec<Option<&'a u8>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp, K: TryFromSexp, L: TryFromSexp> TryFromSexp for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp, K: TryFromSexp, L: TryFromSexp> TryFromSexp for Option<(A, B, C, D, E, F, G, H, I, J, K, L)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D, E, F, G, H, I, J, K, L)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp, K: TryFromSexp, L: TryFromSexp> TryFromSexp for Vec<(A, B, C, D, E, F, G, H, I, J, K, L)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp, K: TryFromSexp, L: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D, E, F, G, H, I, J, K, L)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp, K: TryFromSexp> TryFromSexp for (A, B, C, D, E, F, G, H, I, J, K)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp, K: TryFromSexp> TryFromSexp for Option<(A, B, C, D, E, F, G, H, I, J, K)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D, E, F, G, H, I, J, K)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp, K: TryFromSexp> TryFromSexp for Vec<(A, B, C, D, E, F, G, H, I, J, K)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp, K: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D, E, F, G, H, I, J, K)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp> TryFromSexp for (A, B, C, D, E, F, G, H, I, J)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp> TryFromSexp for Option<(A, B, C, D, E, F, G, H, I, J)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D, E, F, G, H, I, J)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp> TryFromSexp for Vec<(A, B, C, D, E, F, G, H, I, J)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp, J: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D, E, F, G, H, I, J)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp> TryFromSexp for (A, B, C, D, E, F, G, H, I)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp> TryFromSexp for Option<(A, B, C, D, E, F, G, H, I)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D, E, F, G, H, I)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp> TryFromSexp for Vec<(A, B, C, D, E, F, G, H, I)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp, I: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D, E, F, G, H, I)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp> TryFromSexp for (A, B, C, D, E, F, G, H)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp> TryFromSexp for Option<(A, B, C, D, E, F, G, H)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D, E, F, G, H)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp> TryFromSexp for Vec<(A, B, C, D, E, F, G, H)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp, H: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D, E, F, G, H)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp> TryFromSexp for (A, B, C, D, E, F, G)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp> TryFromSexp for Option<(A, B, C, D, E, F, G)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D, E, F, G)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp> TryFromSexp for Vec<(A, B, C, D, E, F, G)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp, G: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D, E, F, G)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp> TryFromSexp for (A, B, C, D, E, F)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp> TryFromSexp for Option<(A, B, C, D, E, F)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D, E, F)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp> TryFromSexp for Vec<(A, B, C, D, E, F)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp, F: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D, E, F)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp> TryFromSexp for (A, B, C, D, E)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp> TryFromSexp for Option<(A, B, C, D, E)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D, E)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp> TryFromSexp for Vec<(A, B, C, D, E)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp, E: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D, E)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp> TryFromSexp for (A, B, C, D)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp> TryFromSexp for Option<(A, B, C, D)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C, D)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp> TryFromSexp for Vec<(A, B, C, D)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp, D: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C, D)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp> TryFromSexp for (A, B, C)

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp> TryFromSexp for Option<(A, B, C)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B, C)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp> TryFromSexp for Vec<(A, B, C)>

Source§

impl<A: TryFromSexp, B: TryFromSexp, C: TryFromSexp> TryFromSexp for Vec<Option<(A, B, C)>>

Source§

impl<A: TryFromSexp, B: TryFromSexp> TryFromSexp for (A, B)

Source§

impl<A: TryFromSexp, B: TryFromSexp> TryFromSexp for Option<(A, B)>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A, B)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp, B: TryFromSexp> TryFromSexp for Vec<(A, B)>

Source§

impl<A: TryFromSexp, B: TryFromSexp> TryFromSexp for Vec<Option<(A, B)>>

Source§

impl<A: TryFromSexp> TryFromSexp for (A,)
where <A as TryFromSexp>::Error: Into<SexpError>,

Source§

impl<A: TryFromSexp> TryFromSexp for Option<(A,)>
where A::Error: Into<SexpError>,

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <(A,)>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<A: TryFromSexp> TryFromSexp for Vec<(A,)>
where A::Error: Into<SexpError>,

Source§

impl<A: TryFromSexp> TryFromSexp for Vec<Option<(A,)>>
where A::Error: Into<SexpError>,

Source§

impl<T, const N: usize> TryFromSexp for [T; N]
where T: RNativeType + Copy,

Blanket impl: Convert R vector to [T; N] where T: RNativeType.

Returns an error if the R vector length doesn’t match N. Useful for SHA hashes ([u8; 32]), fixed-size patterns, etc.

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T: ParseRStr> TryFromSexp for Option<ParsedRStr<T>>

NA_character_ / NULL → None; a parse failure as for the scalar.

Source§

impl<T: ParseRStr> TryFromSexp for Vec<Option<ParsedRStr<T>>>

NA elements → None; parse failures batch as for Vec<T>.

Source§

impl<T: ParseRStr> TryFromSexp for Vec<ParsedRStr<T>>

NA elements and parse failures are collected across the whole vector into one batched InvalidValue, each reason followed by the 1-based positions that failed with it: NA is not allowed (element 2); invalid <label>: <error> (elements 3, 5).

Source§

impl<T: RNativeType> TryFromSexp for Cow<'_, [T]>

Convert an R native vector to an owned Cow.

A raw SEXP carries no borrow lifetime. Use super::TryFromRoot to borrow without copying; generated wrappers select that path for Cow<'_, [T]>.

Source§

type Error = SexpTypeError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T: TryFromSexpElement + TryFromSexp> TryFromSexp for Option<T>
where T::Inner: OptionInner,

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <T::Inner as OptionInner>::OPTION_NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <T::Inner as OptionInner>::OPTION_CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T: TryFromSexpElement> TryFromSexp for Vec<Option<T>>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <T::Inner as VecOptionInner>::VEC_OPTION_NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <T::Inner as VecOptionInner>::VEC_OPTION_CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

fn __mx_try_from_sexp_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>

Source§

unsafe fn __mx_try_from_sexp_unchecked_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>

Source§

impl<T: TryFromSexpElement> TryFromSexp for Vec<T>
where T::Inner: VecInner,

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <T::Inner as VecInner>::VEC_NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <T::Inner as VecInner>::VEC_CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

fn __mx_try_from_sexp_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>

Source§

unsafe fn __mx_try_from_sexp_unchecked_with_check( sexp: SEXP, check: &ElementCheck<'_>, ) -> Result<Self, SexpError>

Source§

impl<T: TypedExternal + Send> TryFromSexp for Option<ExternalPtr<T>>

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T: TypedExternal + Send> TryFromSexp for Vec<ExternalPtr<T>>

Convert an R list (VECSXP) of external pointers to Vec<ExternalPtr<T>>.

Each element must be an EXTPTRSXP carrying a T; conversion delegates to ExternalPtr::<T>::try_from_sexp per element. This lets #[miniextendr] functions accept an R list() of opaque handles (issue #827). A user crate can’t write this impl itself — the orphan rule rejects impl TryFromSexp for Vec<ExternalPtr<T>> there because both Vec and TryFromSexp are foreign — so it lives here, keyed on ExternalPtr<T> to avoid colliding with the atomic-vector impls.

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T: TypedExternal + Send> TryFromSexp for Vec<Option<ExternalPtr<T>>>

Convert an R list (VECSXP) of external pointers / NULLs to Vec<Option<ExternalPtr<T>>>. NULL elements map to None; every other element must be an EXTPTRSXP carrying a T (issue #827).

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for &[T]
where T: RNativeType + Copy,

Blanket impl for &[T] where T: RNativeType

This replaces the macro-generated &'static [T] impls with a more composable blanket impl that works for any lifetime. This enables containers like TinyVec to use blanket impls without needing helper functions.

Source§

impl<T> TryFromSexp for &mut [T]
where T: RNativeType + Copy,

Blanket impl for &mut [T] where T: RNativeType

§Safety note (aliasing)

This impl hands out a &mut view over R’s data pointer without copying, so binding the same R vector to two slice parameters aliases one buffer. That is undefined behavior whenever at least one borrow is mutable — two &mut [T], or a &mut [T] paired with a shared &[T] (which borrows the same buffer). Generated wrappers reject repeated non-empty R vector identities before conversion in every build, including scalar/slice pairs and borrowed leaves inside optional, nested, and boxed containers (#1104, #1252, #1502). Direct callers of this conversion must ensure the resulting borrow does not overlap another live mutable or shared borrow.

Source§

impl<T> TryFromSexp for BinaryHeap<T>
where T: RNativeType + Copy + Ord,

Blanket impl: Convert R vector to BinaryHeap<T> where T: RNativeType + Ord.

Creates a binary heap from the R vector elements.

Source§

type Error = SexpTypeError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for Box<[T]>
where Vec<T>: TryFromSexp,

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <Vec<T> as TryFromSexp>::NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <Vec<T> as TryFromSexp>::CHARACTER_ONLY

Source§

type Error = <Vec<T> as TryFromSexp>::Error

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for Option<&[T]>
where T: RNativeType + Copy,

Blanket impl for Option<&[T]> where T: RNativeType

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&[T] as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for Option<&mut [T]>
where T: RNativeType + Copy,

Blanket impl for Option<&mut [T]> where T: RNativeType

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <&mut [T] as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for Option<BTreeSet<T>>

Convert R value to Option<BTreeSet<T>>: NULL -> None, otherwise Some(set).

Source§

const CHARACTER_ONLY: bool = <BTreeSet<T> as TryFromSexp>::CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for Option<HashSet<T>>

Convert R value to Option<HashSet<T>>: NULL -> None, otherwise Some(set).

Source§

const CHARACTER_ONLY: bool = <HashSet<T> as TryFromSexp>::CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for Option<Vec<T>>

Convert R value to Option<Vec<T>>: NULL → None, otherwise Some(vec).

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <Vec<T> as TryFromSexp>::NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = <Vec<T> as TryFromSexp>::CHARACTER_ONLY

Source§

type Error = SexpError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for Result<T, ()>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = T::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn __mx_input_has_na(&self, input: SEXP) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<T> TryFromSexp for Vec<Vec<T>>

Convert R list (VECSXP) to Vec<Vec<T>>.

Each element of the R list must be convertible to Vec<T>.

Source§

impl<T> TryFromSexp for VecDeque<T>
where T: RNativeType + Copy,

Blanket impl: Convert R vector to VecDeque<T> where T: RNativeType.

Source§

type Error = SexpTypeError

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<V: TryFromSexp> TryFromSexp for BTreeMap<String, V>
where V::Error: Into<SexpError>,

Convert R named list (VECSXP) to BTreeMap<String, V>.

See named_list_to_map for NA/empty name handling (elements with NA/empty names map to key "" and may silently overwrite each other).

Source§

impl<V: TryFromSexp> TryFromSexp for HashMap<String, V>
where V::Error: Into<SexpError>,

Convert R named list (VECSXP) to HashMap<String, V>.

See named_list_to_map for NA/empty name handling (elements with NA/empty names map to key "" and may silently overwrite each other).

Source§

impl<V: TryFromSexp> TryFromSexp for Option<BTreeMap<String, V>>
where V::Error: Into<SexpError>,

Convert R value to Option<BTreeMap<String, V>>: NULL -> None, otherwise Some(map).

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <BTreeMap<String, V> as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<V: TryFromSexp> TryFromSexp for Option<HashMap<String, V>>
where V::Error: Into<SexpError>,

Convert R value to Option<HashMap<String, V>>: NULL -> None, otherwise Some(map).

Source§

const NATIVE_BORROW: Option<NativeBorrow> = <HashMap<String, V> as TryFromSexp>::NATIVE_BORROW

Source§

type Error = SexpError

Source§

fn __mx_has_na(&self) -> bool

Source§

fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>

Source§

impl<V: TryFromSexp> TryFromSexp for Vec<BTreeMap<String, V>>
where V::Error: Into<SexpError>,

Convert R list of named lists to Vec<BTreeMap<String, V>>.

Source§

impl<V: TryFromSexp> TryFromSexp for Vec<HashMap<String, V>>
where V::Error: Into<SexpError>,

Convert R list of named lists to Vec<HashMap<String, V>>.

Implementors§

Source§

impl TryFromSexp for AltrepSexp

Conversion from R SEXP to AltrepSexp.

Only succeeds if the input is an ALTREP vector (ALTREP(sexp) != 0). Non-ALTREP input produces SexpError::InvalidValue.

This is the inverse of TryFromSexp for SEXP, which accepts any SEXP but auto-materializes ALTREP.

Source§

impl TryFromSexp for AsCharacter

Source§

impl TryFromSexp for AsCharacterVec

Source§

impl TryFromSexp for AsNumeric

Source§

impl TryFromSexp for AsNumericVec

Source§

impl TryFromSexp for DataFrame

Source§

impl TryFromSexp for List

A List reads any R list, whatever its names.

Accepts a VECSXP only; anything else is a SexpTypeError. A pairlist (LISTSXP, such as formals(f) or pairlist(...)) is refused, not coerced (#1866): the coerced copy would be a new object that nothing roots, since List is a Copy view, so the first allocation in the function could free it. The caller converts with as.list(), and the argument error says so.

Names are not checked: R allows a name to appear more than once (list(a = 1, a = 2)), and so does List. A function that needs unique names checks with List::first_duplicate_name.

Source§

impl TryFromSexp for ListMut

Source§

impl TryFromSexp for NArgs

The integer scalar nargs() returns, as a non-negative count.

Source§

impl TryFromSexp for NamedList

Source§

impl TryFromSexp for ProtectedStrVec

Source§

impl TryFromSexp for RLogical

Source§

impl TryFromSexp for RValue

Source§

impl TryFromSexp for Rboolean

Source§

impl TryFromSexp for Rcomplex

Source§

impl TryFromSexp for SEXP

Pass-through conversion for raw SEXP values with ALTREP auto-materialization.

This allows SEXP to be used directly in #[miniextendr] function signatures. When R passes an ALTREP vector (e.g., 1:10, seq_len(N)), ensure_materialized is called automatically to force materialization on the R main thread. After this, the SEXP’s data pointer is stable and safe to access from any thread.

§ALTREP handling

InputResult
Regular SEXPPassed through unchanged
ALTREP SEXPMaterialized via ensure_materialized, then passed through

To receive ALTREP without materializing, use AltrepSexp as the parameter type instead. To receive the raw SEXP without any conversion (including no materialization), use extern "C-unwind".

§Safety

SEXP handles are only valid on R’s main thread. Standalone #[miniextendr] functions taking a SEXP parameter run on the main thread automatically.

Source§

impl<'a> TryFromSexp for &'a RLogical

Source§

impl<'a> TryFromSexp for &'a Rcomplex

Source§

impl<'a> TryFromSexp for &'a mut RLogical

§Safety note (aliasing)

This impl can produce aliased &mut references if the same R object is passed to multiple mutable parameters. The caller (generated wrapper) rejects overlapping native mutable/shared borrows before conversion. Direct conversion callers must enforce this borrowing contract themselves.

Source§

impl<'a> TryFromSexp for &'a mut Rcomplex

§Safety note (aliasing)

This impl can produce aliased &mut references if the same R object is passed to multiple mutable parameters. The caller (generated wrapper) rejects overlapping native mutable/shared borrows before conversion. Direct conversion callers must enforce this borrowing contract themselves.

Source§

impl<'a> TryFromSexp for Factor<'a>

Source§

impl<T, R> TryFromSexp for Coerced<T, R>
where R: TryFromSexp + TryCoerce<T>, <R as TryFromSexp>::Error: Into<SexpError>, <R as TryCoerce<T>>::Error: Display,

Convert R value to Coerced<T, R> by reading R and coercing to T.

This enables reading non-native Rust types from R with coercion:

ⓘ
// Read i64 from R integer (i32)
let val: Coerced<i64, i32> = TryFromSexp::try_from_sexp(sexp)?;
let i64_val: i64 = val.into_inner();

// Works with collections too:
let vec: Vec<Coerced<i64, i32>> = ...;
let set: HashSet<Coerced<NonZeroU32, i32>> = ...;
Source§

impl<T: FromStr> TryFromSexp for AsFromStr<T>
where T::Err: Display,

Source§

impl<T: FromStr> TryFromSexp for AsFromStrVec<T>
where T::Err: Display,

Source§

impl<T: ParseRStr> TryFromSexp for ParsedRStr<T>

NA_character_ / NULL → SexpError::Na; a parse failure → InvalidValue("invalid <label>: <error>").

Source§

impl<T: RFactor> TryFromSexp for FactorOptionVec<T>

Source§

impl<T: RNativeType, const NDIM: usize> TryFromSexp for RArray<T, NDIM>

Source§

impl<T: TypedExternal + Send> TryFromSexp for ExternalPtr<T>

Convert R EXTPTRSXP to ExternalPtr<T>.

This enables using ExternalPtr<T> as parameter types in #[miniextendr] functions, for a body that keeps or consumes the handle; a body that only reads the value takes &T.

§Example

ⓘ
#[derive(ExternalPtr)]
struct MyData { value: i32 }

#[miniextendr]
fn process(data: ExternalPtr<MyData>) -> i32 {
    data.borrow().value
}
Source§

impl<T: UnitEnumFactor> TryFromSexp for FactorVec<T>

Source§

impl<T> TryFromSexp for Missing<T>

Source§

const NATIVE_BORROW: Option<NativeBorrow> = T::NATIVE_BORROW

Source§

const CHARACTER_ONLY: bool = T::CHARACTER_ONLY

Source§

type Error = SexpError

Source§

impl<V: AtomicElement> TryFromSexp for NamedVector<BTreeMap<String, V>>

Source§

impl<V: AtomicElement> TryFromSexp for NamedVector<HashMap<String, V>>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<bool, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<f32, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<i8, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<i16, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<i64, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<isize, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<u16, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<u32, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<u64, NDIM>

Source§

impl<const NDIM: usize> TryFromSexp for RArray<usize, NDIM>