#[non_exhaustive]pub enum RObject {
Show 30 variants
Null,
Integer(VectorData<i32>),
Real(VectorData<f64>),
Logical(VectorData<Logical>),
Character(VectorData<Arc<str>>),
Symbol(Arc<str>),
Raw(VectorData<u8>),
Complex(VectorData<Complex>),
List(Vec<RObject>),
Pairlist(Vec<PairlistElement>),
Language {
function: Box<RObject>,
args: Vec<PairlistElement>,
},
Expression(Vec<RObject>),
Closure {
formals: Box<RObject>,
body: Box<RObject>,
environment: Box<RObject>,
},
Environment {
enclosing: Box<RObject>,
frame: Box<RObject>,
hashtab: Box<RObject>,
},
Promise {
value: Box<RObject>,
expression: Box<RObject>,
environment: Box<RObject>,
},
Special {
name: Arc<str>,
},
Builtin {
name: Arc<str>,
},
Bytecode {
code: Box<RObject>,
constants: Box<RObject>,
expr: Box<RObject>,
},
DataFrame(Box<DataFrameData>),
Factor(Box<FactorData>),
S3Object(Box<S3ObjectData>),
S4Object(Box<S4ObjectData>),
Namespace(Vec<Arc<str>>),
GlobalEnv,
BaseEnv,
EmptyEnv,
MissingArg,
UnboundValue,
Shared(Arc<RwLock<RObject>>),
WithAttributes {
object: Box<RObject>,
attributes: Attributes,
},
}Expand description
Represents any R object that can be stored in an RDS file.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
NULL object
Integer(VectorData<i32>)
Integer vector (can be fully loaded or lazy)
Real(VectorData<f64>)
Real (double) vector (can be fully loaded or lazy)
Logical(VectorData<Logical>)
Logical vector (can be fully loaded or lazy)
Character(VectorData<Arc<str>>)
Character vector (using Arc
Symbol(Arc<str>)
Symbol (SYMSXP) - a named symbol Used for R’s internal symbol table and special markers
Raw(VectorData<u8>)
Raw (byte) vector (can be fully loaded or lazy)
Complex(VectorData<Complex>)
Complex vector (can be fully loaded or lazy)
List(Vec<RObject>)
Generic list (VECSXP)
Pairlist(Vec<PairlistElement>)
Pairlist (LISTSXP) with optional tags
Language
Language object (unevaluated call/expression) Contains the function being called and its arguments with optional names
Expression(Vec<RObject>)
Expression vector (vector of language objects) Typically the result of parse() - a collection of unevaluated expressions
Closure
Closure (function) Contains formal parameters, body, and enclosing environment
Environment
Environment Contains parent environment, bindings frame, and hash table
Promise
Promise (lazy evaluation) Contains value, expression, and environment
Special
Special primitive function (like ‘if’, ‘for’, ‘while’) These are internal R functions with special evaluation rules
Builtin
Builtin primitive function (like ‘sum’, ‘c’, ‘+’) These are internal R functions evaluated normally
Bytecode
Bytecode (compiled R function) Contains code vector, constants pool, and original expression
DataFrame(Box<DataFrameData>)
Data frame (list with class=“data.frame”) Boxed to reduce enum size
Factor(Box<FactorData>)
Factor (categorical variable with levels) Boxed to reduce enum size
S3Object(Box<S3ObjectData>)
S3 object (any object with a class attribute) Boxed to reduce enum size
S4Object(Box<S4ObjectData>)
S4 object (formal object with slots) Boxed to reduce enum size
Namespace(Vec<Arc<str>>)
Namespace reference (triggers automatic package loading in R) Contains namespace name components (e.g., [“Matrix”] or [“base”])
GlobalEnv
Global environment reference This is a singleton in R that persists across the session
BaseEnv
Base environment reference Contains base package bindings
EmptyEnv
Empty environment reference The root of the environment tree (has no parent)
MissingArg
Missing argument marker Used for default arguments in function formals
UnboundValue
Unbound value marker Used to indicate an unbound variable
Shared reference to an existing object (used for REFSXP backreferences) to avoid deep cloning large structures during parsing.
WithAttributes
Object with attributes (no class)
Implementations§
Source§impl RObject
impl RObject
Sourcepub fn as_concrete(&self) -> RObject
pub fn as_concrete(&self) -> RObject
If this object is a Shared wrapper, return the underlying object reference. Otherwise return self.
Sourcepub fn into_concrete(self) -> RObject
pub fn into_concrete(self) -> RObject
Consume the object, unwrapping Shared by cloning the underlying object.
Sourcepub fn into_concrete_deep(self) -> RObject
pub fn into_concrete_deep(self) -> RObject
Recursively convert all Shared wrappers to concrete objects throughout the entire tree.
This is essential for thread safety when the resulting RObject will be used across
threads. While each parse has its own RefTable, nested Shared objects (in Lists,
Pairlists, WithAttributes, etc.) share Arc
Uses cycle detection to handle circular references (e.g., in environments).
Sourcepub fn variant_name(&self) -> &'static str
pub fn variant_name(&self) -> &'static str
Human-friendly variant name for debugging.
Sourcepub fn is_fully_loaded(&self) -> bool
pub fn is_fully_loaded(&self) -> bool
Check if this object is fully loaded (no lazy vectors).
Returns true if all vector data is materialized (Owned), false if any
vector is in Lazy state. For non-vector objects, recursively checks nested
objects.
Note: Uses cycle detection to handle circular references in environments/promises.
Sourcepub fn lazy_spans(&self) -> Vec<(String, LazyVector)>
pub fn lazy_spans(&self) -> Vec<(String, LazyVector)>
Collect all lazy vector spans in this object tree.
Returns a vector of tuples containing the path to each lazy vector and its LazyVector metadata (offset, byte_len, length). The path is a dot-separated string describing the location (e.g., “columns.gene_names” for a DataFrame column).
This is useful for understanding the lazy structure of a parsed RDS file.
Note: Uses cycle detection to handle circular references in environments/promises.
Source§impl RObject
impl RObject
Sourcepub const NA_INTEGER: i32 = -2_147_483_648i32
pub const NA_INTEGER: i32 = -2_147_483_648i32
Integer NA value in R
Sourcepub fn is_na_integer(val: i32) -> bool
pub fn is_na_integer(val: i32) -> bool
Check if an integer is NA
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RObject
impl RefUnwindSafe for RObject
impl Send for RObject
impl Sync for RObject
impl Unpin for RObject
impl UnwindSafe for RObject
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)