pub struct AsFromStrVec<T>(pub Vec<T>);Expand description
Wrap a Vec<T: FromStr> parsed from an R character vector.
Each element of the R character vector is parsed into T. Every failure is
collected into one error (the first 10 listed, then "and N more"), each
with its quoted value and 1-based position ("n/a": invalid digit found in string (element 2)). An NA_character_ element is refused
(NA is not allowed (element 3)), not parsed as "".
For numbers read like R’s as.numeric(), with NA as None, use
AsNumericVec instead.
§Example
use std::net::IpAddr;
#[miniextendr]
fn parse_ips(addrs: AsFromStrVec<IpAddr>) -> Vec<bool> {
addrs.0.into_iter().map(|ip| ip.is_loopback()).collect()
}
// R: parse_ips(c("127.0.0.1", "8.8.8.8")) → c(TRUE, FALSE)Tuple Fields§
§0: Vec<T>Trait Implementations§
Source§impl<T: Clone> Clone for AsFromStrVec<T>
impl<T: Clone> Clone for AsFromStrVec<T>
Source§impl<T: Debug> Debug for AsFromStrVec<T>
impl<T: Debug> Debug for AsFromStrVec<T>
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§fn try_into_sexp(self) -> Result<SEXP, Self::Error>
fn try_into_sexp(self) -> Result<SEXP, Self::Error>
Source§unsafe fn try_into_sexp_unchecked(self) -> Result<SEXP, Self::Error>
unsafe fn try_into_sexp_unchecked(self) -> Result<SEXP, Self::Error>
Source§unsafe fn into_sexp_unchecked(self) -> SEXP
unsafe fn into_sexp_unchecked(self) -> SEXP
Source§impl<T: FromStr> TryFromSexp for AsFromStrVec<T>
impl<T: FromStr> TryFromSexp for AsFromStrVec<T>
Source§const CHARACTER_ONLY: bool = true
const CHARACTER_ONLY: bool = true
NULL, is a character vector or a factor. Read moreSource§fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>
fn try_from_sexp(sexp: SEXP) -> Result<Self, Self::Error>
Source§const NATIVE_BORROW: Option<NativeBorrow> = None
const NATIVE_BORROW: Option<NativeBorrow> = None
Source§#[doc(hidden)]const __MX_EXPECTATION: Option<&'static str> = None
#[doc(hidden)]const __MX_EXPECTATION: Option<&'static str> = None
#[miniextendr] cannot tell from the type as written: the
<expected> of a failed conversion’s '<p>' must be <expected>: .... Read moreSource§unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>
unsafe fn try_from_sexp_unchecked(sexp: SEXP) -> Result<Self, Self::Error>
Source§#[doc(hidden)]unsafe fn __mx_try_from_rooted(root: Root<'_>) -> Result<Self, Self::Error>
#[doc(hidden)]unsafe fn __mx_try_from_rooted(root: Root<'_>) -> Result<Self, Self::Error>
Source§#[doc(hidden)]fn __mx_has_na(&self) -> bool
#[doc(hidden)]fn __mx_has_na(&self) -> bool
#[miniextendr(no_na)]
refuses after the conversion. Read moreSource§#[doc(hidden)]fn __mx_input_has_na(&self, input: SEXP) -> bool
#[doc(hidden)]fn __mx_input_has_na(&self, input: SEXP) -> bool
#[miniextendr(no_na)] refuses this converted argument, read
from input (the R value it converted from), when no R guard ran. Read moreSource§#[doc(hidden)]fn __mx_try_from_sexp_with_check(
sexp: SEXP,
check: &ElementCheck<'_>,
) -> Result<Self, SexpError>
#[doc(hidden)]fn __mx_try_from_sexp_with_check(
sexp: SEXP,
check: &ElementCheck<'_>,
) -> Result<Self, SexpError>
check, an element type’s
TryFromSexpElement::check_sexp,
on the R value that carries an element’s class (#1837). Read moreSource§#[doc(hidden)]unsafe fn __mx_try_from_sexp_unchecked_with_check(
sexp: SEXP,
check: &ElementCheck<'_>,
) -> Result<Self, SexpError>
#[doc(hidden)]unsafe fn __mx_try_from_sexp_unchecked_with_check(
sexp: SEXP,
check: &ElementCheck<'_>,
) -> Result<Self, SexpError>
Auto Trait Implementations§
impl<T> Freeze for AsFromStrVec<T>
impl<T> RefUnwindSafe for AsFromStrVec<T>where
Vec<T>: RefUnwindSafe,
impl<T> Send for AsFromStrVec<T>
impl<T> Sync for AsFromStrVec<T>
impl<T> Unpin for AsFromStrVec<T>
impl<T> UnsafeUnpin for AsFromStrVec<T>where
Vec<T>: UnsafeUnpin,
impl<T> UnwindSafe for AsFromStrVec<T>where
Vec<T>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConsumingFallible for Twhere
T: Clone,
Source§impl<T> RDebug for Twhere
T: Debug,
impl<T> RDebug for Twhere
T: Debug,
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes