Skip to main content

Module rvalue

Module rvalue 

Source
Expand description

RValue — an owned, Send, R-native value tree.

The serde_json::Value analogue for R’s base data types: an owned (no live SEXP), inspectable (Debug + Clone), Send (crosses the worker boundary) representation of “an arbitrary R native value”. Use it wherever you need to carry a dynamic/heterogeneous R value through Rust — e.g. condition data = payloads, which travel through panic_any and may be raised on the worker thread where a live SEXP would be illegal.

The variants enumerate R’s (finite, closed) data type system — vectors only, since R has no true scalars. NA is modelled with Option where R carries it out of band (logical/integer/character); Double carries NA in the NA_REAL bit pattern inside Vec<f64> (no Option), matching R’s in-band convention.

Out of scope (existing homes): closures/environments/symbols/language objects (not data), S4 objects, EXTPTRSXP (use crate::externalptr::ExternalPtr), ALTREP internals. Attribute-carrying values (factor, Date, POSIXct) are modelled as their plain Integer/Double storage in v1 — richer handling is deferred until a consumer needs it.

Macros§

try_from_scalar_opt 🔒
TryFrom<RValue> for a scalar pulled from a length-1 Option-backed variant.
try_from_vec 🔒
TryFrom<RValue> for the whole vector of a single variant (NA preserved).

Enums§

RValue
An owned, Send, R-native value tree. See the module docs.

Functions§

list_into_sexp 🔒
Build a VECSXP from list pairs, recursing into each child.
wrong_type 🔒
Type error for a variant mismatch: the value’s SEXPTYPE vs the expected one.