Struct extendr_api::wrapper::lang::Language
source · pub struct Language { /* private fields */ }
Expand description
Wrapper for creating language objects.
use extendr_api::prelude::*;
test! {
let call_to_xyz = r!(Language::from_values(&[sym!(xyz), r!(1), r!(2)]));
assert_eq!(call_to_xyz.is_language(), true);
assert_eq!(call_to_xyz.len(), 3);
}
Note: You can use the lang! macro for this.
Implementations§
source§impl Language
impl Language
pub fn from_values<T>(values: T) -> Selfwhere T: IntoIterator, T::IntoIter: DoubleEndedIterator, T::Item: Into<Robj>,
pub fn iter(&self) -> PairlistIter ⓘ
pub fn names(&self) -> impl Iterator<Item = &'static str>
pub fn values(&self) -> impl Iterator<Item = Robj>
Trait Implementations§
source§impl Conversions for Language
impl Conversions for Language
as_*()
source§fn as_language(&self) -> Option<Language>
fn as_language(&self) -> Option<Language>
Convert a language object to a Language wrapper. Read more
source§fn as_pairlist(&self) -> Option<Pairlist>
fn as_pairlist(&self) -> Option<Pairlist>
Convert a pair list object (LISTSXP) to a Pairlist wrapper. Read more
source§fn as_expressions(&self) -> Option<Expressions>
fn as_expressions(&self) -> Option<Expressions>
Convert an expression object (EXPRSXP) to a Expr wrapper. Read more
source§fn as_environment(&self) -> Option<Environment>
fn as_environment(&self) -> Option<Environment>
Convert an environment object (ENVSXP) to a Env wrapper. Read more
source§fn as_function(&self) -> Option<Function>
fn as_function(&self) -> Option<Function>
Convert a function object (CLOSXP) to a Function wrapper. Read more
source§fn as_promise(&self) -> Option<Promise>
fn as_promise(&self) -> Option<Promise>
Get a wrapper for a promise.
source§impl Operators for Language
impl Operators for Language
dollar() etc.
source§fn dollar<T>(&self, symbol: T) -> Result<Robj>where
T: AsRef<str>,
fn dollar<T>(&self, symbol: T) -> Result<Robj>where T: AsRef<str>,
Do the equivalent of x$y Read more
source§fn slice<T>(&self, rhs: T) -> Result<Robj>where
T: Into<Robj>,
fn slice<T>(&self, rhs: T) -> Result<Robj>where T: Into<Robj>,
Do the equivalent of
x[y]
Read moresource§fn index<T>(&self, rhs: T) -> Result<Robj>where
T: Into<Robj>,
fn index<T>(&self, rhs: T) -> Result<Robj>where T: Into<Robj>,
Do the equivalent of
x[[y]]
Read moresource§fn tilde<T>(&self, rhs: T) -> Result<Robj>where
T: Into<Robj>,
fn tilde<T>(&self, rhs: T) -> Result<Robj>where T: Into<Robj>,
Do the equivalent of x ~ y Read more
source§impl PartialEq<Language> for Language
impl PartialEq<Language> for Language
source§impl Rinternals for Language
impl Rinternals for Language
find_var() etc.
source§fn is_logical(&self) -> bool
fn is_logical(&self) -> bool
Return true if this is a boolean (logical) vector
source§fn is_complex(&self) -> bool
fn is_complex(&self) -> bool
Return true if this is a complex vector.
source§fn is_expressions(&self) -> bool
fn is_expressions(&self) -> bool
Return true if this is an expression.
source§fn is_environment(&self) -> bool
fn is_environment(&self) -> bool
Return true if this is an environment.
source§fn is_promise(&self) -> bool
fn is_promise(&self) -> bool
Return true if this is an environment.
source§fn is_external_pointer(&self) -> bool
fn is_external_pointer(&self) -> bool
Return true if this is an expression.
source§fn get_current_srcref(val: i32) -> Robj
fn get_current_srcref(val: i32) -> Robj
Get the source ref.
source§fn get_src_filename(&self) -> Robj
fn get_src_filename(&self) -> Robj
Get the source filename.
source§fn as_character_vector(&self) -> Robj
fn as_character_vector(&self) -> Robj
Convert to a string vector.
source§fn coerce_vector(&self, sexptype: u32) -> Robj
fn coerce_vector(&self, sexptype: u32) -> Robj
Convert to vectors of many kinds.
source§fn pair_to_vector_list(&self) -> Robj
fn pair_to_vector_list(&self) -> Robj
Convert a pairlist (LISTSXP) to a vector list (VECSXP).
source§fn vector_to_pair_list(&self) -> Robj
fn vector_to_pair_list(&self) -> Robj
Convert a vector list (VECSXP) to a pair list (LISTSXP)
source§fn as_character_factor(&self) -> Robj
fn as_character_factor(&self) -> Robj
Convert a factor to a string vector.
source§fn duplicate(&self) -> Robj
fn duplicate(&self) -> Robj
Do a deep copy of this object.
Note that clone() only adds a reference.
source§fn find_function<K: TryInto<Symbol, Error = Error>>(
&self,
key: K
) -> Result<Robj>
fn find_function<K: TryInto<Symbol, Error = Error>>( &self, key: K ) -> Result<Robj>
Find a function in an environment ignoring other variables. Read more
source§fn find_var<K: TryInto<Symbol, Error = Error>>(&self, key: K) -> Result<Robj>
fn find_var<K: TryInto<Symbol, Error = Error>>(&self, key: K) -> Result<Robj>
Find a variable in an environment. Read more
source§fn eval_promise(&self) -> Result<Robj>
fn eval_promise(&self) -> Result<Robj>
If this object is a promise, evaluate it, otherwise return the object. Read more
source§fn xlengthgets(&self, new_len: usize) -> Result<Robj>
fn xlengthgets(&self, new_len: usize) -> Result<Robj>
Copy a vector and resize it.
See. https://github.com/hadley/r-internals/blob/master/vectors.md
source§fn alloc_vector(sexptype: u32, len: usize) -> Robj
fn alloc_vector(sexptype: u32, len: usize) -> Robj
Allocated an owned object of a certain type.
source§fn is_function(&self) -> bool
fn is_function(&self) -> bool
Return true if this is a function or a primitive (CLOSXP, BUILTINSXP or SPECIALSXP)
source§fn is_integer(&self) -> bool
fn is_integer(&self) -> bool
Return true if this is an integer vector (INTSXP) but not a factor.
source§fn is_language(&self) -> bool
fn is_language(&self) -> bool
Return true if this is a language object (LANGSXP).
source§fn is_pairlist(&self) -> bool
fn is_pairlist(&self) -> bool
Return true if this is NILSXP or LISTSXP.
source§fn is_number(&self) -> bool
fn is_number(&self) -> bool
Return true if this is INTSXP, LGLSXP or REALSXP but not a factor.
source§fn is_primitive(&self) -> bool
fn is_primitive(&self) -> bool
Return true if this is a primitive function BUILTINSXP, SPECIALSXP.
source§fn is_user_binop(&self) -> bool
fn is_user_binop(&self) -> bool
Return true if this is a user defined binop.
source§fn is_valid_string(&self) -> bool
fn is_valid_string(&self) -> bool
Return true if this is a valid string.
source§fn is_valid_string_f(&self) -> bool
fn is_valid_string_f(&self) -> bool
Return true if this is a valid string.
source§fn is_vector_atomic(&self) -> bool
fn is_vector_atomic(&self) -> bool
Return true if this is an atomic vector.
source§fn is_vector_list(&self) -> bool
fn is_vector_list(&self) -> bool
Return true if this is a vector list.
source§fn is_vectorizable(&self) -> bool
fn is_vectorizable(&self) -> bool
Return true if this is can be made into a vector.
fn is_missing_arg(&self) -> bool
fn is_unbound_value(&self) -> bool
fn is_package_env(&self) -> bool
fn package_env_name(&self) -> Robj
fn is_namespace_env(&self) -> bool
fn namespace_env_spec(&self) -> Robj
source§fn is_altinteger(&self) -> bool
fn is_altinteger(&self) -> bool
Returns
true
if this is an integer ALTREP object.source§fn is_altreal(&self) -> bool
fn is_altreal(&self) -> bool
Returns
true
if this is an real ALTREP object.source§fn is_altlogical(&self) -> bool
fn is_altlogical(&self) -> bool
Returns
true
if this is an logical ALTREP object.source§fn is_altstring(&self) -> bool
fn is_altstring(&self) -> bool
Returns
true
if this is an integer ALTREP object.