[−][src]Enum extendr_api::Robj
Wrapper for an R S-expression pointer (SEXP).
As much as possible we wish to make this object safe (ie. no segfaults).
If you avoid using unsafe functions it is more likely that you will avoid panics and segfaults. We will take great trouble to ensure that this is true.
Variants
Owned(SEXP)
This object owns the SEXP and must free it.
Borrowed(SEXP)
This object references a SEXP such as an input parameter.
Sys(SEXP)
This object references a SEXP owned by libR.
Implementations
impl Robj
[src]
pub unsafe fn get(&self) -> SEXP
[src]
Get a copy of the underlying SEXP. Note: this is unsafe.
pub unsafe fn get_mut(&mut self) -> Option<SEXP>
[src]
Get a copy of the underlying SEXP for mutable types. This is valid only for owned objects as we are not permitted to modify parameters or system objects.
pub fn sexptype(&self) -> u32
[src]
Get the XXXSXP type of the object.
pub fn len(&self) -> usize
[src]
Get the extended length of the object.
pub fn as_i32_slice(&self) -> Option<&[i32]>
[src]
Get a read-only reference to the content of an integer or logical vector.
pub fn as_logical_slice(&self) -> Option<&[Bool]>
[src]
Get a read-only reference to the content of an integer or logical vector.
pub fn as_f64_slice(&self) -> Option<&[f64]>
[src]
Get a read-only reference to the content of a double vector.
pub fn as_u8_slice(&self) -> Option<&[u8]>
[src]
Get a read-only reference to the content of an integer or logical vector.
pub fn as_i32_slice_mut(&mut self) -> Option<&mut [i32]>
[src]
Get a read-write reference to the content of an integer or logical vector.
pub fn as_f64_slice_mut(&mut self) -> Option<&mut [f64]>
[src]
Get a read-write reference to the content of a double vector.
pub fn as_u8_slice_mut(&mut self) -> Option<&mut [u8]>
[src]
Get a read-write reference to the content of an integer or logical vector.
pub fn pairlist_iter(&self) -> Option<ListIter>
[src]
Get an iterator over a pairlist.
pub fn list_iter(&self) -> Option<VecIter>
[src]
Get an iterator over an unnamed list.
pub fn str_iter(&self) -> Option<StrIter>
[src]
Get an iterator over a string vector.
pub fn as_str(&self) -> Option<&str>
[src]
Get a read-only reference to a char, symbol or string type.
pub fn eval(&self) -> Result<Robj, AnyError>
[src]
Evaluate the expression and return an error or an R object.
pub fn eval_blind(&self) -> Robj
[src]
Evaluate the expression and return NULL or an R object.
pub fn parse(code: &str) -> Result<Robj, AnyError>
[src]
Parse a string into an R executable object
pub fn eval_string(code: &str) -> Result<Robj, AnyError>
[src]
Parse a string into an R executable object and run it.
pub unsafe fn unprotected(self) -> Robj
[src]
Unprotect an object - assumes a transfer of ownership. This is unsafe because the object pointer may be left dangling.
pub fn is_owned(&self) -> bool
[src]
Return true if the object is owned by this wrapper. If so, it will be released when the wrapper drops.
impl Robj
[src]
The following impls wrap specific Rinternals.h symbols.
pub fn globalEnv() -> Robj
[src]
The "global" environment
pub fn emptyEnv() -> Robj
[src]
An empty environment at the root of the environment tree
pub fn baseEnv() -> Robj
[src]
The base environment; formerly R_NilValue
pub fn baseNamespace() -> Robj
[src]
The (fake) namespace for base
pub fn namespaceRegistry() -> Robj
[src]
for registered namespaces
pub fn srcref() -> Robj
[src]
Current srcref, for debuggers
pub fn nilValue() -> Robj
[src]
The nil object
pub fn unboundValue() -> Robj
[src]
Unbound marker
pub fn missingArg() -> Robj
[src]
Missing argument marker
pub fn baseSymbol() -> Robj
[src]
"base"
pub fn braceSymbol() -> Robj
[src]
"{"
pub fn bracket2Symbol() -> Robj
[src]
"[["
pub fn bracketSymbol() -> Robj
[src]
"["
pub fn classSymbol() -> Robj
[src]
"class"
pub fn deviceSymbol() -> Robj
[src]
".Device"
pub fn dimNamesSymbol() -> Robj
[src]
"dimnames"
pub fn dimSymbol() -> Robj
[src]
"dim"
pub fn dollarSymbol() -> Robj
[src]
"$"
pub fn dotsSymbol() -> Robj
[src]
"..."
pub fn doubleColonSymbol() -> Robj
[src]
pub fn dropSymbol() -> Robj { unsafe { new_sys(R_DropSymbol) }}"drop"
pub fn lastvalueSymbol() -> Robj
[src]
".Last.value"
pub fn levelsSymbol() -> Robj
[src]
"levels"
pub fn modeSymbol() -> Robj
[src]
"mode"
pub fn naRmSymbol() -> Robj
[src]
"na.rm"
pub fn nameSymbol() -> Robj
[src]
"name"
pub fn namesSymbol() -> Robj
[src]
"names"
pub fn namespaceEnvSymbol() -> Robj
[src]
NAMESPACE_."
pub fn packageSymbol() -> Robj
[src]
"package"
pub fn previousSymbol() -> Robj
[src]
"previous"
pub fn quoteSymbol() -> Robj
[src]
"quote"
pub fn rowNamesSymbol() -> Robj
[src]
"row.names"
pub fn seedsSymbol() -> Robj
[src]
".Random.seed"
pub fn sortListSymbol() -> Robj
[src]
"sort.list"
pub fn sourceSymbol() -> Robj
[src]
"source"
pub fn specSymbol() -> Robj
[src]
"spec"
pub fn tspSymbol() -> Robj
[src]
"tsp"
pub fn tripleColonSymbol() -> Robj
[src]
":::"
pub fn dot_defined() -> Robj
[src]
".defined"
pub fn dot_Method() -> Robj
[src]
".Method"
pub fn dot_packageName() -> Robj
[src]
"packageName"
pub fn dot_target() -> Robj
[src]
".target"
pub fn naString() -> Robj
[src]
NA_STRING as a CHARSXP
pub fn blankString() -> Robj
[src]
"" as a CHARSXP
pub fn blankScalarString() -> Robj
[src]
as a STRSXP
impl Robj
[src]
The following impls wrap specific Rinternals.h functions.
pub fn isNull(&self) -> bool
[src]
Return true if this is the null object.
pub fn isSymbol(&self) -> bool
[src]
Return true if this is a symbol.
pub fn isLogical(&self) -> bool
[src]
Return true if this is a boolean (logical) vector
pub fn isReal(&self) -> bool
[src]
Return true if this is a real (f64) vector.
pub fn isComplex(&self) -> bool
[src]
Return true if this is a complex vector.
pub fn isExpression(&self) -> bool
[src]
Return true if this is an expression.
pub fn isEnvironment(&self) -> bool
[src]
Return true if this is an environment.
pub fn isString(&self) -> bool
[src]
Return true if this is a string.
pub fn isObject(&self) -> bool
[src]
Return true if this is an object.
pub fn getCurrentSrcref(val: i32) -> Robj
[src]
Get the source ref.
pub fn getSrcFilename(&self) -> Robj
[src]
Get the source filename.
pub fn asChar(&self) -> Robj
[src]
Convert to a string vector.
pub fn coerceVector(&self, sexptype: u32) -> Robj
[src]
Convert to vectors of many kinds.
pub fn pairToVectorList(&self) -> Robj
[src]
Convert a pairlist (LISTSXP) to a vector list (VECSXP).
pub fn vectorToPairList(&self) -> Robj
[src]
Convert a vector list (VECSXP) to a pair list (LISTSXP)
pub fn asCharacterFactor(&self) -> Robj
[src]
Assign an integer to each unique string and return a "factor".
pub fn asLogical(&self) -> bool
[src]
Get a scalar boolean value
pub fn asInteger(&self) -> i32
[src]
Get a scalar 32 bit integer value
pub fn asReal(&self) -> f64
[src]
Get a 64 bit double value
pub fn allocMatrix(sexptype: SEXPTYPE, rows: i32, cols: i32) -> Robj
[src]
Allocate a matrix object (see NumericMatrix etc.)
pub fn duplicate(&self) -> Self
[src]
Compatible way to duplicate an object. Use obj.clone() instead for Rust compaitibility.
pub fn ncols(&self) -> usize
[src]
Number of columns of a matrix
pub fn nrows(&self) -> usize
[src]
Number of rows of a matrix
pub unsafe fn makeExternalPtr<T>(p: *mut T, tag: Robj, prot: Robj) -> Self
[src]
Internal function used to implement #[extendr] impl
pub unsafe fn externalPtrAddr<T>(&self) -> *mut T
[src]
Internal function used to implement #[extendr] impl
pub unsafe fn externalPtrTag(&self) -> Self
[src]
Internal function used to implement #[extendr] impl
pub unsafe fn externalPtrProtected(&self) -> Self
[src]
Internal function used to implement #[extendr] impl
pub unsafe fn registerCFinalizer(&self, func: R_CFinalizer_t)
[src]
pub fn xlengthgets(&self, new_len: usize) -> Result<Robj, AnyError>
[src]
Read-only access to attribute list. Copy a vector and resize it. See. https://github.com/hadley/r-internals/blob/master/vectors.md
pub fn allocVector(sexptype: u32, len: usize) -> Robj
[src]
Allocated an owned object of a certain type.
pub fn conformable(a: &Robj, b: &Robj) -> bool
[src]
Return true if two arrays have identical dims.
pub fn elt(&self, index: usize) -> Robj
[src]
Borrow an element from a list.
pub fn isArray(&self) -> bool
[src]
Return true if this is an array.
pub fn isFactor(&self) -> bool
[src]
Return true if this is factor.
pub fn isFrame(&self) -> bool
[src]
Return true if this is a data frame.
pub fn isFunction(&self) -> bool
[src]
Return true if this is a function.
pub fn isInteger(&self) -> bool
[src]
Return true if this is an integer vector.
pub fn isLanguage(&self) -> bool
[src]
Return true if this is a language object.
pub fn isList(&self) -> bool
[src]
Return true if this is a vector list.
pub fn isMatrix(&self) -> bool
[src]
Return true if this is a matrix.
pub fn isNewList(&self) -> bool
[src]
Return true if this is a vector list or null.
pub fn isNumber(&self) -> bool
[src]
Return true if this is a numeric vector but not a factor.
pub fn isNumeric(&self) -> bool
[src]
Return true if this is a numeric vector but not a factor or complex.
pub fn isPairList(&self) -> bool
[src]
Return true if this is a pairlist.
pub fn isPrimitive(&self) -> bool
[src]
Return true if this is a primitive function.
pub fn isTs(&self) -> bool
[src]
Return true if this is a time series vector (see tsp).
pub fn isUserBinop(&self) -> bool
[src]
Return true if this is a user defined binop.
pub fn isValidString(&self) -> bool
[src]
Return true if this is a valid string.
pub fn isValidStringF(&self) -> bool
[src]
Return true if this is a valid string.
pub fn isVector(&self) -> bool
[src]
Return true if this is a vector.
pub fn isVectorAtomic(&self) -> bool
[src]
Return true if this is an atomic vector.
pub fn isVectorList(&self) -> bool
[src]
Return true if this is a vector list.
pub fn isVectorizable(&self) -> bool
[src]
Return true if this is can be made into a vector.
pub fn check_external_ptr(&self, expected_tag: &str) -> bool
[src]
Check an external pointer tag This may work better by using a symbol cached in a static variable.
Trait Implementations
impl AsTypedSlice<f64> for Robj
[src]
pub fn as_typed_slice(&self) -> Option<&[f64]>
[src]
pub fn as_typed_slice_mut(&mut self) -> Option<&mut [f64]>
[src]
impl AsTypedSlice<i32> for Robj
[src]
pub fn as_typed_slice(&self) -> Option<&[i32]>
[src]
pub fn as_typed_slice_mut(&mut self) -> Option<&mut [i32]>
[src]
impl AsTypedSlice<u8> for Robj
[src]
pub fn as_typed_slice(&self) -> Option<&[u8]>
[src]
pub fn as_typed_slice_mut(&mut self) -> Option<&mut [u8]>
[src]
impl Clone for Robj
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Robj
[src]
Implement {:?} formatting.
impl Default for Robj
[src]
impl Drop for Robj
[src]
Release any owned objects.
impl<'_> From<&'_ [bool]> for Robj
[src]
Convert a bool slice to a logical object.
impl<'_> From<&'_ [f64]> for Robj
[src]
Convert a double slice to a numeric object.
impl<'_> From<&'_ [u8]> for Robj
[src]
Convert a byte slice to a raw object.
impl<'a, '_> From<&'a [&'_ str]> for Robj
[src]
impl<'a> From<&'a [Bool]> for Robj
[src]
Convert an integer slice to a logical object.
impl<'a> From<&'a [i32]> for Robj
[src]
Convert an integer slice to an integer object.
impl<'a> From<&'a str> for Robj
[src]
Convert a string ref to an Robj string array object.
impl From<()> for Robj
[src]
Convert a null to an Robj.
impl From<*mut SEXPREC> for Robj
[src]
Borrow an already protected SEXP Note that the SEXP must outlive the generated object.
impl<'a> From<Character<'a>> for Robj
[src]
Convert a wrapped string ref to an Robj char object.
impl<'a> From<Lang<'a>> for Robj
[src]
Convert a wrapped string ref to an Robj language object.
impl<'a> From<List<'a>> for Robj
[src]
Make a list object from an array of Robjs.
impl<'a> From<Symbol<'a>> for Robj
[src]
Convert a string to a symbol.
impl<T: AsRef<str>> From<Vec<T, Global>> for Robj
[src]
Convert vectors of strings to an R object.
impl From<bool> for Robj
[src]
Convert a boolean to an Robj.
impl From<f32> for Robj
[src]
impl From<f64> for Robj
[src]
impl From<i16> for Robj
[src]
impl From<i32> for Robj
[src]
impl From<i64> for Robj
[src]
impl From<i8> for Robj
[src]
impl From<u16> for Robj
[src]
impl From<u32> for Robj
[src]
impl From<u64> for Robj
[src]
impl From<u8> for Robj
[src]
impl From<usize> for Robj
[src]
Convert a length value to an Robj. Note: This is good only up to 2^53, but that exceeds the address space of current generation computers (8PiB)
impl<'a> FromRobj<'a> for Robj
[src]
Pass-through Robj conversion.
impl<'a> PartialEq<[f64]> for Robj
[src]
Compare equality with slices of double.
pub fn eq(&self, rhs: &[f64]) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialEq<[i32]> for Robj
[src]
Compare equality with integer slices.
pub fn eq(&self, rhs: &[i32]) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialEq<List<'a>> for Robj
[src]
pub fn eq(&self, rhs: &List<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<Robj> for Robj
[src]
Compare equality with two Robjs.
impl PartialEq<str> for Robj
[src]
Compare equality with strings.
Auto Trait Implementations
impl RefUnwindSafe for Robj
impl !Send for Robj
impl !Sync for Robj
impl Unpin for Robj
impl UnwindSafe for Robj
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,