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 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§type Error = Infallible
type Error = Infallible
Source§fn try_into_sexp(self) -> Result<SEXP, Self::Error>
fn try_into_sexp(self) -> Result<SEXP, Self::Error>
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,
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