pub enum RValue {
Null,
Logical(Vec<Option<bool>>),
Integer(Vec<Option<i32>>),
Double(Vec<f64>),
Complex(Vec<Rcomplex>),
Character(Vec<Option<String>>),
Raw(Vec<u8>),
List(Vec<(Option<String>, RValue)>),
}Expand description
An owned, Send, R-native value tree. See the module docs.
Variants§
Null
NULL (NILSXP).
Logical(Vec<Option<bool>>)
Logical vector (LGLSXP). None is NA.
Integer(Vec<Option<i32>>)
Integer vector (INTSXP). None is NA.
Double(Vec<f64>)
Double vector (REALSXP). NA is carried in the NA_REAL bit pattern.
Complex(Vec<Rcomplex>)
Complex vector (CPLXSXP).
Character(Vec<Option<String>>)
Character vector (STRSXP). None is NA.
Raw(Vec<u8>)
Raw byte vector (RAWSXP). No NA.
List(Vec<(Option<String>, RValue)>)
Generic list (VECSXP). Recursive; a None name is an unnamed slot.
Implementations§
Source§impl RValue
impl RValue
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
true if this is RValue::Null.
Sourcepub fn debug<T: Debug>(value: T) -> Self
pub fn debug<T: Debug>(value: T) -> Self
Wrap any T: Debug as a length-1 Character carrying its {:?}
rendering — the escape hatch for a value with no R-native mapping
(e.g. a Rust range). The rendering happens eagerly here, so nothing
borrows across the Send boundary a condition payload crosses.
assert_eq!(RValue::debug(0..=100).as_str(), Some("0..=100"));Sourcepub fn as_i32(&self) -> Option<i32>
pub fn as_i32(&self) -> Option<i32>
The single non-NA i32 of a length-1 Integer, else None.
Returns None for the wrong variant, a length other than 1, or NA —
the borrow-friendly counterpart to i32::try_from when you don’t need
to know why it failed.
Trait Implementations§
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>> From<(A, B, C, D)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>> From<(A, B, C, D)> for RValue
Source§fn from(value: (A, B, C, D)) -> Self
fn from(value: (A, B, C, D)) -> Self
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>> From<(A, B, C, D, E)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>> From<(A, B, C, D, E)> for RValue
Source§fn from(value: (A, B, C, D, E)) -> Self
fn from(value: (A, B, C, D, E)) -> Self
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>> From<(A, B, C, D, E, F)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>> From<(A, B, C, D, E, F)> for RValue
Source§fn from(value: (A, B, C, D, E, F)) -> Self
fn from(value: (A, B, C, D, E, F)) -> Self
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>> From<(A, B, C, D, E, F, G)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>> From<(A, B, C, D, E, F, G)> for RValue
Source§fn from(value: (A, B, C, D, E, F, G)) -> Self
fn from(value: (A, B, C, D, E, F, G)) -> Self
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>> From<(A, B, C, D, E, F, G, H)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>> From<(A, B, C, D, E, F, G, H)> for RValue
Source§fn from(value: (A, B, C, D, E, F, G, H)) -> Self
fn from(value: (A, B, C, D, E, F, G, H)) -> Self
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>, I: Into<RValue>> From<(A, B, C, D, E, F, G, H, I)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>, I: Into<RValue>> From<(A, B, C, D, E, F, G, H, I)> for RValue
Source§fn from(value: (A, B, C, D, E, F, G, H, I)) -> Self
fn from(value: (A, B, C, D, E, F, G, H, I)) -> Self
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>, I: Into<RValue>, J: Into<RValue>> From<(A, B, C, D, E, F, G, H, I, J)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>, I: Into<RValue>, J: Into<RValue>> From<(A, B, C, D, E, F, G, H, I, J)> for RValue
Source§fn from(value: (A, B, C, D, E, F, G, H, I, J)) -> Self
fn from(value: (A, B, C, D, E, F, G, H, I, J)) -> Self
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>, I: Into<RValue>, J: Into<RValue>, K: Into<RValue>> From<(A, B, C, D, E, F, G, H, I, J, K)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>, I: Into<RValue>, J: Into<RValue>, K: Into<RValue>> From<(A, B, C, D, E, F, G, H, I, J, K)> for RValue
Source§fn from(value: (A, B, C, D, E, F, G, H, I, J, K)) -> Self
fn from(value: (A, B, C, D, E, F, G, H, I, J, K)) -> Self
Source§impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>, I: Into<RValue>, J: Into<RValue>, K: Into<RValue>, L: Into<RValue>> From<(A, B, C, D, E, F, G, H, I, J, K, L)> for RValue
impl<A: Into<RValue>, B: Into<RValue>, C: Into<RValue>, D: Into<RValue>, E: Into<RValue>, F: Into<RValue>, G: Into<RValue>, H: Into<RValue>, I: Into<RValue>, J: Into<RValue>, K: Into<RValue>, L: Into<RValue>> From<(A, B, C, D, E, F, G, H, I, J, K, L)> for RValue
Source§fn from(value: (A, B, C, D, E, F, G, H, I, J, K, L)) -> Self
fn from(value: (A, B, C, D, E, F, G, H, I, J, K, L)) -> Self
Source§impl From<i64> for RValue
Wide-integer ladder: an i64 (or u32) that fits in i32 and is not
i32::MIN (R’s NA_integer_) becomes an Integer; anything else becomes a
Double. Mirrors R’s own integer→double promotion for out-of-range values.
impl From<i64> for RValue
Wide-integer ladder: an i64 (or u32) that fits in i32 and is not
i32::MIN (R’s NA_integer_) becomes an Integer; anything else becomes a
Double. Mirrors R’s own integer→double promotion for out-of-range values.
Source§impl IntoR for RValue
impl IntoR for RValue
Source§impl TryFromSexp for RValue
impl TryFromSexp for RValue
Source§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§const CHARACTER_ONLY: bool = false
const CHARACTER_ONLY: bool = false
NULL, is a character vector or a factor. Read moreSource§#[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 Freeze for RValue
impl RefUnwindSafe for RValue
impl Send for RValue
impl Sync for RValue
impl Unpin for RValue
impl UnsafeUnpin for RValue
impl UnwindSafe for RValue
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: 32 bytes
Size for each variant:
Null: 0 bytesLogical: 24 bytesInteger: 24 bytesDouble: 24 bytesComplex: 24 bytesCharacter: 24 bytesRaw: 24 bytesList: 24 bytes