extendr_api::robj

Struct Robj

Source
pub struct Robj {
    inner: SEXP,
}
Expand description

Wrapper for an R S-expression pointer (SEXP).

Create R objects from rust types and iterators:

use extendr_api::prelude::*;
test! {
    // Different ways of making integer scalar 1.
    let non_na : Option<i32> = Some(1);
    let a : Robj = vec![1].into();
    let b = r!(1);
    let c = r!(vec![1]);
    let d = r!(non_na);
    let e = r!([1]);
    assert_eq!(a, b);
    assert_eq!(a, c);
    assert_eq!(a, d);
    assert_eq!(a, e);

    // Different ways of making boolean scalar TRUE.
    let a : Robj = true.into();
    let b = r!(TRUE);
    assert_eq!(a, b);

    // Create a named list
    let a = list!(a = 1, b = "x");
    assert_eq!(a.len(), 2);

    // Use an iterator (like 1:10)
    let a = r!(1 ..= 10);
    assert_eq!(a, r!([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]));

    // Use an iterator (like (1:10)[(1:10) %% 3 == 0])
    let a = (1 ..= 10).filter(|v| v % 3 == 0).collect_robj();
    assert_eq!(a, r!([3, 6, 9]));
}

Convert to/from Rust vectors.

use extendr_api::prelude::*;
test! {
    let a : Robj = r!(vec![1., 2., 3., 4.]);
    let b : Vec<f64> = a.as_real_vector().unwrap();
    assert_eq!(a.len(), 4);
    assert_eq!(b, vec![1., 2., 3., 4.]);
}

Iterate over names and values.

use extendr_api::prelude::*;
test! {
    let abc = list!(a = 1, b = "x", c = vec![1, 2]);
    let names : Vec<_> = abc.names().unwrap().collect();
    let names_and_values : Vec<_> = abc.as_list().unwrap().iter().collect();
    assert_eq!(names, vec!["a", "b", "c"]);
    assert_eq!(names_and_values, vec![("a", r!(1)), ("b", r!("x")), ("c", r!(vec![1, 2]))]);
}

NOTE: 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.

Fields§

§inner: SEXP

Implementations§

Source§

impl Robj

Source

pub fn from_sexp(sexp: SEXP) -> Self

Source

pub fn from_sexp_ref(sexp: &SEXP) -> &Self

A ref of an robj can be constructed from a ref to a SEXP as they have the same layout.

Source§

impl Robj

Source

pub fn is_na(&self) -> bool

Is this object is an NA scalar? Works for character, integer and numeric types.

use extendr_api::prelude::*;
test! {

assert_eq!(r!(NA_INTEGER).is_na(), true);
assert_eq!(r!(NA_REAL).is_na(), true);
assert_eq!(r!(NA_STRING).is_na(), true);
}
Source

pub fn as_integer_slice<'a>(&self) -> Option<&'a [i32]>

Get a read-only reference to the content of an integer vector.

use extendr_api::prelude::*;
test! {

let robj = r!([1, 2, 3]);
assert_eq!(robj.as_integer_slice().unwrap(), [1, 2, 3]);
}
Source

pub fn as_integers(&self) -> Option<Integers>

Convert an Robj into Integers.

Source

pub fn as_integer_vector(&self) -> Option<Vec<i32>>

Get a Vec<i32> copied from the object.

use extendr_api::prelude::*;
test! {

let robj = r!([1, 2, 3]);
assert_eq!(robj.as_integer_slice().unwrap(), vec![1, 2, 3]);
}
Source

pub fn as_logical_slice(&self) -> Option<&[Rbool]>

Get a read-only reference to the content of a logical vector using the tri-state Rbool. Returns None if not a logical vector.

use extendr_api::prelude::*;
test! {
    let robj = r!([TRUE, FALSE]);
    assert_eq!(robj.as_logical_slice().unwrap(), [TRUE, FALSE]);
}
Source

pub fn as_logical_vector(&self) -> Option<Vec<Rbool>>

Get a Vec<Rbool> copied from the object using the tri-state Rbool. Returns None if not a logical vector.

use extendr_api::prelude::*;
test! {
    let robj = r!([TRUE, FALSE]);
    assert_eq!(robj.as_logical_vector().unwrap(), vec![TRUE, FALSE]);
}
Source

pub fn as_logical_iter(&self) -> Option<impl Iterator<Item = &Rbool>>

Get an iterator over logical elements of this slice.

use extendr_api::prelude::*;
test! {
    let robj = r!([TRUE, FALSE, NA_LOGICAL]);
    let mut num_na = 0;
    for val in robj.as_logical_iter().unwrap() {
      if val.is_na() {
          num_na += 1;
      }
    }
    assert_eq!(num_na, 1);
}
Source

pub fn as_real_slice(&self) -> Option<&[f64]>

Get a read-only reference to the content of a double vector. Note: the slice may contain NaN or NA values. We may introduce a “Real” type to handle this like the Rbool type.

use extendr_api::prelude::*;
test! {
    let robj = r!([Some(1.), None, Some(3.)]);
    let mut tot = 0.;
    for val in robj.as_real_slice().unwrap() {
      if !val.is_na() {
        tot += val;
      }
    }
    assert_eq!(tot, 4.);
}
Source

pub fn as_real_iter(&self) -> Option<impl Iterator<Item = &f64>>

Get an iterator over real elements of this slice.

use extendr_api::prelude::*;
test! {
    let robj = r!([1., 2., 3.]);
    let mut tot = 0.;
    for val in robj.as_real_iter().unwrap() {
      if !val.is_na() {
        tot += val;
      }
    }
    assert_eq!(tot, 6.);
}
Source

pub fn as_real_vector(&self) -> Option<Vec<f64>>

Get a Vec<f64> copied from the object.

use extendr_api::prelude::*;
test! {
    let robj = r!([1., 2., 3.]);
    assert_eq!(robj.as_real_vector().unwrap(), vec![1., 2., 3.]);
}
Source

pub fn as_raw_slice(&self) -> Option<&[u8]>

Get a read-only reference to the content of an integer or logical vector.

use extendr_api::prelude::*;
test! {
    let robj = r!(Raw::from_bytes(&[1, 2, 3]));
    assert_eq!(robj.as_raw_slice().unwrap(), &[1, 2, 3]);
}
Source

pub fn as_integer_slice_mut(&mut self) -> Option<&mut [i32]>

Get a read-write reference to the content of an integer or logical vector. Note that rust slices are 0-based so slice[1] is the middle value.

use extendr_api::prelude::*;
test! {
    let mut robj = r!([1, 2, 3]);
    let slice : & mut [i32] = robj.as_integer_slice_mut().unwrap();
    slice[1] = 100;
    assert_eq!(robj, r!([1, 100, 3]));
}
Source

pub fn as_real_slice_mut(&mut self) -> Option<&mut [f64]>

Get a read-write reference to the content of a double vector. Note that rust slices are 0-based so slice[1] is the middle value.

use extendr_api::prelude::*;
test! {
    let mut robj = r!([1.0, 2.0, 3.0]);
    let slice = robj.as_real_slice_mut().unwrap();
    slice[1] = 100.0;
    assert_eq!(robj, r!([1.0, 100.0, 3.0]));
}
Source

pub fn as_raw_slice_mut(&mut self) -> Option<&mut [u8]>

Get a read-write reference to the content of a raw vector.

use extendr_api::prelude::*;
test! {
    let mut robj = r!(Raw::from_bytes(&[1, 2, 3]));
    let slice = robj.as_raw_slice_mut().unwrap();
    slice[1] = 100;
    assert_eq!(robj, r!(Raw::from_bytes(&[1, 100, 3])));
}
Source

pub fn as_string_vector(&self) -> Option<Vec<String>>

Get a vector of owned strings. Owned strings have long lifetimes, but are much slower than references.

use extendr_api::prelude::*;
test! {
   let robj1 = Robj::from("xyz");
   assert_eq!(robj1.as_string_vector(), Some(vec!["xyz".to_string()]));
   let robj2 = Robj::from(1);
   assert_eq!(robj2.as_string_vector(), None);
}
Source

pub fn as_str_vector(&self) -> Option<Vec<&str>>

Get a vector of string references. String references (&str) are faster, but have short lifetimes.

use extendr_api::prelude::*;
test! {
   let robj1 = Robj::from("xyz");
   assert_eq!(robj1.as_str_vector(), Some(vec!["xyz"]));
   let robj2 = Robj::from(1);
   assert_eq!(robj2.as_str_vector(), None);
}
Source

pub fn as_str<'a>(&self) -> Option<&'a str>

Get a read-only reference to a scalar string type.

use extendr_api::prelude::*;
test! {
   let robj1 = Robj::from("xyz");
   let robj2 = Robj::from(1);
   assert_eq!(robj1.as_str(), Some("xyz"));
   assert_eq!(robj2.as_str(), None);
}
Source

pub fn as_integer(&self) -> Option<i32>

Get a scalar integer.

use extendr_api::prelude::*;
test! {
   let robj1 = Robj::from("xyz");
   let robj2 = Robj::from(1);
   let robj3 = Robj::from(NA_INTEGER);
   assert_eq!(robj1.as_integer(), None);
   assert_eq!(robj2.as_integer(), Some(1));
   assert_eq!(robj3.as_integer(), None);
}
Source

pub fn as_real(&self) -> Option<f64>

Get a scalar real.

use extendr_api::prelude::*;
test! {
   let robj1 = Robj::from(1);
   let robj2 = Robj::from(1.);
   let robj3 = Robj::from(NA_REAL);
   assert_eq!(robj1.as_real(), None);
   assert_eq!(robj2.as_real(), Some(1.));
   assert_eq!(robj3.as_real(), None);
}
Source

pub fn as_bool(&self) -> Option<bool>

Get a scalar rust boolean.

use extendr_api::prelude::*;
test! {
   let robj1 = Robj::from(TRUE);
   let robj2 = Robj::from(1.);
   let robj3 = Robj::from(NA_LOGICAL);
   assert_eq!(robj1.as_bool(), Some(true));
   assert_eq!(robj2.as_bool(), None);
   assert_eq!(robj3.as_bool(), None);
}
Source

pub fn as_logical(&self) -> Option<Rbool>

Get a scalar boolean as a tri-boolean Rbool value.

use extendr_api::prelude::*;
test! {
   let robj1 = Robj::from(TRUE);
   let robj2 = Robj::from([TRUE, FALSE]);
   let robj3 = Robj::from(NA_LOGICAL);
   assert_eq!(robj1.as_logical(), Some(TRUE));
   assert_eq!(robj2.as_logical(), None);
   assert_eq!(robj3.as_logical().unwrap().is_na(), true);
}

Trait Implementations§

Source§

impl<Rhs> Add<Rhs> for Robj
where Rhs: Into<Robj>,

Source§

fn add(self, rhs: Rhs) -> Self::Output

Add two R objects, consuming the left hand side. panics on error.

use extendr_api::prelude::*;
test! {

// lhs and rhs get dropped here
let lhs = r!([1, 2]);
let rhs = r!([10, 20]);
assert_eq!(lhs + rhs, r!([11, 22]));

// lhs gets dropped and rhs is a temporary object.
let lhs = r!([1, 2]);
assert_eq!(lhs + 1000, r!([1001, 1002]));

// Only lhs gets dropped.
let lhs = r!([1, 2]);
let rhs = r!([10, 20]);
assert_eq!(lhs + &rhs, r!([11, 22]));
}
Source§

type Output = Robj

The resulting type after applying the + operator.
Source§

impl AsStrIter for Robj

Source§

fn as_str_iter(&self) -> Option<StrIter>

Get an iterator over a string vector. Returns None if the object is not a string vector but works for factors. Read more
Source§

impl<'a> AsTypedSlice<'a, Complex<f64>> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [c64]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [c64]>

Source§

impl<'a> AsTypedSlice<'a, Rbool> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [Rbool]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [Rbool]>

Source§

impl<'a> AsTypedSlice<'a, Rcomplex> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [Rcomplex]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [Rcomplex]>

Source§

impl<'a> AsTypedSlice<'a, Rcplx> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [Rcplx]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [Rcplx]>

Source§

impl<'a> AsTypedSlice<'a, Rfloat> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [Rfloat]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [Rfloat]>

Source§

impl<'a> AsTypedSlice<'a, Rint> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [Rint]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [Rint]>

Source§

impl<'a> AsTypedSlice<'a, Rstr> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [Rstr]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [Rstr]>

Source§

impl<'a> AsTypedSlice<'a, f64> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [f64]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [f64]>

Source§

impl<'a> AsTypedSlice<'a, i32> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [i32]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [i32]>

Source§

impl<'a> AsTypedSlice<'a, u8> for Robj
where Self: 'a,

Source§

fn as_typed_slice(&self) -> Option<&'a [u8]>

Source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [u8]>

Source§

impl Attributes for Robj

Source§

fn get_attrib<'a, N>(&self, name: N) -> Option<Robj>
where Self: 'a, Robj: From<N> + 'a,

Get a specific attribute as a borrowed Robj if it exists. Read more
Source§

fn has_attrib<'a, N>(&self, name: N) -> bool
where Self: 'a, Robj: From<N> + 'a,

Return true if an attribute exists.
Source§

fn set_attrib<N, V>(&mut self, name: N, value: V) -> Result<&mut Self>
where N: Into<Robj>, V: Into<Robj>,

Set a specific attribute in-place and return the object. Read more
Source§

fn names(&self) -> Option<StrIter>

Get the names attribute as a string iterator if one exists. Read more
Source§

fn has_names(&self) -> bool

Return true if this object has an attribute called names.
Source§

fn set_names<T>(&mut self, names: T) -> Result<&mut Self>

Set the names attribute from a string iterator. Read more
Source§

fn dim(&self) -> Option<Integers>

Get the dim attribute as an integer iterator if one exists. Read more
Source§

fn dimnames(&self) -> Option<ListIter>

Get the dimnames attribute as a list iterator if one exists. Read more
Source§

fn class(&self) -> Option<StrIter>

Get the class attribute as a string iterator if one exists. Read more
Source§

fn set_class<T>(&mut self, class: T) -> Result<&mut Self>

Set the class attribute from a string iterator, and return the same object. Read more
Source§

fn inherits(&self, classname: &str) -> bool

Return true if this object has this class attribute. Implicit classes are not supported. Read more
Source§

fn levels(&self) -> Option<StrIter>

Get the levels attribute as a string iterator if one exists. Read more
Source§

impl Clone for Robj

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Conversions for Robj

Source§

fn as_symbol(&self) -> Option<Symbol>

Convert a symbol object to a Symbol wrapper. Read more
Source§

fn as_char(&self) -> Option<Rstr>

Convert a CHARSXP object to a Rstr wrapper. Read more
Source§

fn as_raw(&self) -> Option<Raw>

Convert a raw object to a Rstr wrapper. Read more
Source§

fn as_language(&self) -> Option<Language>

Convert a language object to a Language wrapper. Read more
Source§

fn as_pairlist(&self) -> Option<Pairlist>

Convert a pair list object (LISTSXP) to a Pairlist wrapper. Read more
Source§

fn as_list(&self) -> Option<List>

Convert a list object (VECSXP) to a List wrapper. Read more
Source§

fn as_expressions(&self) -> Option<Expressions>

Convert an expression object (EXPRSXP) to a Expr wrapper. Read more
Source§

fn as_environment(&self) -> Option<Environment>

Convert an environment object (ENVSXP) to a Env wrapper. Read more
Source§

fn as_function(&self) -> Option<Function>

Convert a function object (CLOSXP) to a Function wrapper. Read more
Source§

fn as_promise(&self) -> Option<Promise>

Get a wrapper for a promise.
Source§

impl Debug for Robj

Implement {:?} formatting.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Robj

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Robj

Source§

fn deserialize<D>(deserializer: D) -> Result<Robj, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'de> Deserializer<'de> for &'de Robj

Source§

type Error = Error

The error type that can be returned if some error occurs during deserialization.
Source§

fn deserialize_any<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Require the Deserializer to figure out how to drive the visitor based on what data type is in the input. Read more
Source§

fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit value.
Source§

fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a bool value.
Source§

fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i8 value.
Source§

fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i16 value.
Source§

fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i32 value.
Source§

fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i64 value.
Source§

fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i128 value. Read more
Source§

fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u8 value.
Source§

fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u16 value.
Source§

fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u32 value.
Source§

fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u64 value.
Source§

fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an u128 value. Read more
Source§

fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a f32 value.
Source§

fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a f64 value.
Source§

fn deserialize_char<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a char value.
Source§

fn deserialize_str<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_string<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_option<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an optional value. Read more
Source§

fn deserialize_unit_struct<V>(self, _name: &str, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit struct with a particular name.
Source§

fn deserialize_newtype_struct<V>( self, _name: &str, visitor: V, ) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a newtype struct with a particular name.
Source§

fn deserialize_tuple<V>(self, _len: usize, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values and knows how many values there are without looking at the serialized data.
Source§

fn deserialize_tuple_struct<V>( self, _name: &'static str, _len: usize, visitor: V, ) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a tuple struct with a particular name and number of fields.
Source§

fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values.
Source§

fn deserialize_map<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a map of key-value pairs.
Source§

fn deserialize_struct<V>( self, _name: &'static str, _fields: &'static [&'static str], visitor: V, ) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a struct with a particular name and fields.
Source§

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting the name of a struct field or the discriminant of an enum variant.
Source§

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more
Source§

fn deserialize_enum<V>( self, _name: &'static str, _variants: &'static [&'static str], visitor: V, ) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an enum value with a particular name and possible variants.
Source§

fn is_human_readable(&self) -> bool

Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more
Source§

impl<Rhs> Div<Rhs> for Robj
where Rhs: Into<Robj>,

Source§

fn div(self, rhs: Rhs) -> Self::Output

Divide two R objects, consuming the left hand side. panics on error.

use extendr_api::prelude::*;
test! {

// lhs and rhs get dropped here
let lhs = r!([10.0, 20.0]);
let rhs = r!([1.0, 2.0]);
assert_eq!(lhs / rhs, r!([10.0, 10.0]));

// lhs gets dropped and rhs is a temporary object.
let lhs = r!([10.0, 30.0]);
assert_eq!(lhs / 10.0, r!([1.0, 3.0]));

// Only lhs gets dropped.
let lhs = r!([10.0, 20.0]);
let rhs = r!([1.0, 2.0]);
assert_eq!(lhs / &rhs, r!([10.0, 10.0]));
}
Source§

type Output = Robj

The resulting type after applying the / operator.
Source§

impl Drop for Robj

Release any owned objects.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'de> EnumAccess<'de> for &'de Robj

Source§

type Error = Error

The error type that can be returned if some error occurs during deserialization.
Source§

type Variant = &'de Robj

The Visitor that will be used to deserialize the content of the enum variant.
Source§

fn variant_seed<V>(self, seed: V) -> Result<(V::Value, Self::Variant)>
where V: DeserializeSeed<'de>,

variant is called to identify which variant to deserialize. Read more
Source§

fn variant<V>(self) -> Result<(V, Self::Variant), Self::Error>
where V: Deserialize<'de>,

variant is called to identify which variant to deserialize. Read more
Source§

impl Eval for Robj

Source§

fn eval(&self) -> Result<Robj>

Evaluate the expression in R and return an error or an R object. Read more
Source§

fn eval_with_env(&self, env: &Environment) -> Result<Robj>

Evaluate the expression in R and return an error or an R object. Read more
Source§

fn eval_blind(&self) -> Robj

Evaluate the expression and return NULL or an R object. Read more
Source§

impl<'a, T> From<&'a [T]> for Robj
where Self: 'a, T: 'a, &'a T: ToVectorValue,

Source§

fn from(val: &'a [T]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, const N: usize> From<&'a [T; N]> for Robj
where Self: 'a, &'a T: ToVectorValue + 'a,

Source§

fn from(val: &'a [T; N]) -> Self

Converts to this type from the input type.
Source§

impl From<&Altrep> for Robj

Source§

fn from(val: &Altrep) -> Self

Make an robj from a wrapper.

Source§

impl From<&Complexes> for Robj

Source§

fn from(val: &Complexes) -> Self

Make an robj from a wrapper.

Source§

impl From<&Doubles> for Robj

Source§

fn from(val: &Doubles) -> Self

Make an robj from a wrapper.

Source§

impl From<&Environment> for Robj

Source§

fn from(val: &Environment) -> Self

Make an robj from a wrapper.

Source§

impl From<&Expressions> for Robj

Source§

fn from(val: &Expressions) -> Self

Make an robj from a wrapper.

Source§

impl From<&Function> for Robj

Source§

fn from(val: &Function) -> Self

Make an robj from a wrapper.

Source§

impl From<&Integers> for Robj

Source§

fn from(val: &Integers) -> Self

Make an robj from a wrapper.

Source§

impl From<&Language> for Robj

Source§

fn from(val: &Language) -> Self

Make an robj from a wrapper.

Source§

impl From<&List> for Robj

Source§

fn from(val: &List) -> Self

Make an robj from a wrapper.

Source§

impl From<&Logicals> for Robj

Source§

fn from(val: &Logicals) -> Self

Make an robj from a wrapper.

Source§

impl From<&Pairlist> for Robj

Source§

fn from(val: &Pairlist) -> Self

Make an robj from a wrapper.

Source§

impl From<&Primitive> for Robj

Source§

fn from(val: &Primitive) -> Self

Make an robj from a wrapper.

Source§

impl From<&Promise> for Robj

Source§

fn from(val: &Promise) -> Self

Make an robj from a wrapper.

Source§

impl From<&Raw> for Robj

Source§

fn from(val: &Raw) -> Self

Make an robj from a wrapper.

Source§

impl From<&Robj> for Robj

Convert an Robj reference into a borrowed Robj.

Source§

fn from(val: &Robj) -> Self

Converts to this type from the input type.
Source§

impl From<&Rstr> for Robj

Source§

fn from(val: &Rstr) -> Self

Make an robj from a wrapper.

Source§

impl From<&S4> for Robj

Source§

fn from(val: &S4) -> Self

Make an robj from a wrapper.

Source§

impl From<&Strings> for Robj

Source§

fn from(val: &Strings) -> Self

Make an robj from a wrapper.

Source§

impl From<&Symbol> for Robj

Source§

fn from(val: &Symbol) -> Self

Make an robj from a wrapper.

Source§

impl<T: ToVectorValue + Clone> From<&Vec<T>> for Robj

Source§

fn from(value: &Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, const N: usize> From<&'a mut [T; N]> for Robj
where Self: 'a, &'a mut T: ToVectorValue + 'a,

Source§

fn from(val: &'a mut [T; N]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, const N: usize> From<[T; N]> for Robj
where Self: 'a, T: ToVectorValue,

Source§

fn from(val: [T; N]) -> Self

Converts to this type from the input type.
Source§

impl From<()> for Robj

Convert a null to an Robj.

Source§

fn from(_: ()) -> Self

Converts to this type from the input type.
Source§

impl From<Altrep> for Robj

Source§

fn from(val: Altrep) -> Self

Make an robj from a wrapper.

Source§

impl From<Arg> for Robj

Source§

fn from(val: Arg) -> Self

Converts to this type from the input type.
Source§

impl From<Complexes> for Robj

Source§

fn from(val: Complexes) -> Self

Make an robj from a wrapper.

Source§

impl<T> From<Dataframe<T>> for Robj

Source§

fn from(value: Dataframe<T>) -> Self

Converts to this type from the input type.
Source§

impl From<Doubles> for Robj

Source§

fn from(val: Doubles) -> Self

Make an robj from a wrapper.

Source§

impl<L, R> From<Either<L, R>> for Robj
where Robj: From<L> + From<R>,

Source§

fn from(value: Either<L, R>) -> Self

Converts to this type from the input type.
Source§

impl From<Environment> for Robj

Source§

fn from(val: Environment) -> Self

Make an robj from a wrapper.

Source§

impl From<Error> for Robj

Source§

fn from(res: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Expressions> for Robj

Source§

fn from(val: Expressions) -> Self

Make an robj from a wrapper.

Source§

impl<T> From<ExternalPtr<T>> for Robj

Source§

fn from(val: ExternalPtr<T>) -> Self

Converts to this type from the input type.
Source§

impl From<Func> for Robj

Source§

fn from(val: Func) -> Self

Converts to this type from the input type.
Source§

impl From<Function> for Robj

Source§

fn from(val: Function) -> Self

Make an robj from a wrapper.

Source§

impl From<Impl> for Robj

Source§

fn from(val: Impl) -> Self

Converts to this type from the input type.
Source§

impl From<Integers> for Robj

Source§

fn from(val: Integers) -> Self

Make an robj from a wrapper.

Source§

impl From<Language> for Robj

Source§

fn from(val: Language) -> Self

Make an robj from a wrapper.

Source§

impl From<List> for Robj

Source§

fn from(val: List) -> Self

Make an robj from a wrapper.

Source§

impl From<ListIter> for Robj

Source§

fn from(iter: ListIter) -> Self

You can return a ListIter from a function.

use extendr_api::prelude::*;
test! {
    let listiter = list!(1, 2).values();
    assert_eq!(Robj::from(listiter), Robj::from(list!(1, 2)));
}
Source§

impl From<Logicals> for Robj

Source§

fn from(val: Logicals) -> Self

Make an robj from a wrapper.

Source§

impl From<Mat<f64>> for Robj

Source§

fn from(value: Mat<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<MatRef<'_, f64>> for Robj

Source§

fn from(value: MatRef<'_, f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Metadata> for Robj

Source§

fn from(val: Metadata) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Nullable<T>> for Robj
where T: Into<Robj>,

Source§

fn from(val: Nullable<T>) -> Self

Convert a rust object to NULL or another type.

use extendr_api::prelude::*;
test! {
    assert_eq!(r!(Nullable::<i32>::Null), r!(NULL));
    assert_eq!(r!(Nullable::<i32>::NotNull(1)), r!(1));
}
Source§

impl From<Option<Complexes>> for Robj

Source§

fn from(value: Option<Complexes>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Option<Dataframe<T>>> for Robj

Source§

fn from(value: Option<Dataframe<T>>) -> Self

Converts to this type from the input type.
Source§

impl From<Option<Doubles>> for Robj

Source§

fn from(value: Option<Doubles>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Option<ExternalPtr<T>>> for Robj

Source§

fn from(value: Option<ExternalPtr<T>>) -> Self

Converts to this type from the input type.
Source§

impl From<Option<Integers>> for Robj

Source§

fn from(value: Option<Integers>) -> Self

Converts to this type from the input type.
Source§

impl From<Option<Logicals>> for Robj

Source§

fn from(value: Option<Logicals>) -> Self

Converts to this type from the input type.
Source§

impl<T, D> From<Option<RArray<T, D>>> for Robj

Source§

fn from(value: Option<RArray<T, D>>) -> Self

Converts to this type from the input type.
Source§

impl From<Option<Raw>> for Robj

Source§

fn from(value: Option<Raw>) -> Self

Converts to this type from the input type.
Source§

impl From<Option<S4>> for Robj

Source§

fn from(value: Option<S4>) -> Self

Converts to this type from the input type.
Source§

impl From<Option<Strings>> for Robj

Source§

fn from(value: Option<Strings>) -> Self

Converts to this type from the input type.
Source§

impl From<Pairlist> for Robj

Source§

fn from(val: Pairlist) -> Self

Make an robj from a wrapper.

Source§

impl From<PairlistIter> for Robj

Source§

fn from(iter: PairlistIter) -> Self

You can return a PairlistIter from a function.

Source§

impl From<Primitive> for Robj

Source§

fn from(val: Primitive) -> Self

Make an robj from a wrapper.

Source§

impl From<Promise> for Robj

Source§

fn from(val: Promise) -> Self

Make an robj from a wrapper.

Source§

impl<T, D> From<RArray<T, D>> for Robj

Source§

fn from(array: RArray<T, D>) -> Self

Convert a column, matrix or matrix3d to an Robj.

Source§

impl<T> From<Range<T>> for Robj

Source§

fn from(val: Range<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<RangeInclusive<T>> for Robj

Source§

fn from(val: RangeInclusive<T>) -> Self

Converts to this type from the input type.
Source§

impl From<Raw> for Robj

Source§

fn from(val: Raw) -> Self

Make an robj from a wrapper.

Source§

impl<T, E> From<Result<T, E>> for Robj
where T: Into<Robj>, E: Debug,

Convert a Result to an Robj.

Panics if there is an error.

To use the ?-operator, an extendr-function must return either extendr_api::error::Result or std::result::Result. Use of panic! in extendr is discouraged due to memory leakage.

Alternative behaviors enabled by feature toggles: extendr-api supports different conversions from Result<T,E> into Robj. Below, x_ok represents an R variable on R side which was returned from rust via T::into_robj() or similar. Likewise, x_err was returned to R side from rust via E::into_robj() or similar. extendr-api

  • result_list: Ok(T) is encoded as list(ok = x_ok, err = NULL) and Err as list(ok = NULL, err = e_err).
  • result_condition': Ok(T) is encoded as x_ok and Err(E) as condition(msg="extendr_error", value = x_err, class=c("extendr_error", "error", "condition"))
  • More than one enabled feature: Only one feature gate will take effect, the current order of precedence is [result_list, result_condition, … ].
  • Neither of the above (default): Ok(T) is encoded as x_okand Err(E) will trigger throw_r_error(), which is discouraged.
use extendr_api::prelude::*;
fn my_func() -> Result<f64> {
    Ok(1.0)
}

test! {
    assert_eq!(r!(my_func()), r!(1.0));
}
Source§

fn from(res: Result<T, E>) -> Self

Converts to this type from the input type.
Source§

impl From<Rstr> for Robj

Source§

fn from(val: Rstr) -> Self

Make an robj from a wrapper.

Source§

impl From<S4> for Robj

Source§

fn from(val: S4) -> Self

Make an robj from a wrapper.

Source§

impl From<Strings> for Robj

Source§

fn from(val: Strings) -> Self

Make an robj from a wrapper.

Source§

impl From<Symbol> for Robj

Source§

fn from(val: Symbol) -> Self

Make an robj from a wrapper.

Source§

impl<T> From<T> for Robj
where T: ToVectorValue,

Source§

fn from(scalar: T) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Robj>> for Robj

Source§

fn from(val: Vec<Robj>) -> Self

Convert a vector of Robj into a list.

Source§

impl From<Vec<Rstr>> for Robj

Source§

fn from(val: Vec<Rstr>) -> Self

Convert a vector of Rstr into strings.

Source§

impl<T: ToVectorValue> From<Vec<T>> for Robj

Source§

fn from(value: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl GetSexp for Robj

Source§

unsafe fn get(&self) -> SEXP

Get a copy of the underlying SEXP. Read more
Source§

unsafe fn get_mut(&mut self) -> SEXP

Source§

fn as_robj(&self) -> &Robj

Get a reference to a Robj for this type.
Source§

fn as_robj_mut(&mut self) -> &mut Robj

Get a mutable reference to a Robj for this type.
Source§

impl Length for Robj

Source§

fn len(&self) -> usize

Get the extended length of the object. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the Robj contains no elements. Read more
Source§

impl Load for Robj

Source§

fn load<P: AsRef<Path>>( path: &P, format: PstreamFormat, hook: Option<ReadHook>, ) -> Result<Robj>

Save an object in the R data format. version should probably be 3.
Source§

fn from_reader<R: Read>( reader: &mut R, format: PstreamFormat, hook: Option<ReadHook>, ) -> Result<Robj>

Save an object in the R data format to a Write trait. version should probably be 3.
Source§

impl MatrixConversions for Robj

Source§

fn as_column<E>(&self) -> Option<RColumn<E>>
where Robj: for<'a> AsTypedSlice<'a, E>,

Source§

fn as_matrix<E>(&self) -> Option<RMatrix<E>>
where Robj: for<'a> AsTypedSlice<'a, E>,

Source§

fn as_matrix3d<E>(&self) -> Option<RMatrix3D<E>>
where Robj: for<'a> AsTypedSlice<'a, E>,

Source§

impl<Rhs> Mul<Rhs> for Robj
where Rhs: Into<Robj>,

Source§

fn mul(self, rhs: Rhs) -> Self::Output

Multiply two R objects, consuming the left hand side. panics on error.

use extendr_api::prelude::*;
test! {

// lhs and rhs get dropped here
let lhs = r!([10.0, 20.0]);
let rhs = r!([1.0, 2.0]);
assert_eq!(lhs * rhs, r!([10.0, 40.0]));

// lhs gets dropped and rhs is a temporary object.
let lhs = r!([1.0, 2.0]);
assert_eq!(lhs * 10.0, r!([10.0, 20.0]));

// Only lhs gets dropped.
let lhs = r!([10.0, 20.0]);
let rhs = r!([1.0, 2.0]);
assert_eq!(lhs * &rhs, r!([10.0, 40.0]));
}
Source§

type Output = Robj

The resulting type after applying the * operator.
Source§

impl Operators for Robj

Source§

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>,

Do the equivalent of x[y] Read more
Source§

fn index<T>(&self, rhs: T) -> Result<Robj>
where T: Into<Robj>,

Do the equivalent of x[[y]] Read more
Source§

fn tilde<T>(&self, rhs: T) -> Result<Robj>
where T: Into<Robj>,

Do the equivalent of x ~ y Read more
Source§

fn double_colon<T>(&self, rhs: T) -> Result<Robj>
where T: Into<Robj>,

Do the equivalent of x :: y Read more
Source§

fn call(&self, args: Pairlist) -> Result<Robj>

Do the equivalent of x(a, b, c) Read more
Source§

impl PartialEq<[f64]> for Robj

Compare equality with slices of double.

Source§

fn eq(&self, rhs: &[f64]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<[i32]> for Robj

Compare equality with integer slices.

Source§

fn eq(&self, rhs: &[i32]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<str> for Robj

Compare equality with strings.

Source§

fn eq(&self, rhs: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Robj

Compare equality with two Robjs.

Source§

fn eq(&self, rhs: &Robj) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Rinternals for Robj

Source§

fn is_null(&self) -> bool

Return true if this is the null object.
Source§

fn is_symbol(&self) -> bool

Return true if this is a symbol.
Source§

fn is_logical(&self) -> bool

Return true if this is a boolean (logical) vector
Source§

fn is_real(&self) -> bool

Return true if this is a real (f64) vector.
Source§

fn is_complex(&self) -> bool

Return true if this is a complex vector.
Source§

fn is_expressions(&self) -> bool

Return true if this is an expression.
Source§

fn is_environment(&self) -> bool

Return true if this is an environment.
Source§

fn is_promise(&self) -> bool

Return true if this is an environment.
Source§

fn is_string(&self) -> bool

Return true if this is a string.
Source§

fn is_object(&self) -> bool

Return true if this is an object (ie. has a class attribute).
Source§

fn is_s4(&self) -> bool

Return true if this is a S4 object.
Source§

fn is_external_pointer(&self) -> bool

Return true if this is an expression.
Source§

fn get_current_srcref(val: i32) -> Robj

Get the source ref.
Source§

fn get_src_filename(&self) -> Robj

Get the source filename.
Source§

fn as_character_vector(&self) -> Robj

Convert to a string vector.
Source§

fn coerce_vector(&self, sexptype: SEXPTYPE) -> Robj

Convert to vectors of many kinds.
Source§

fn pair_to_vector_list(&self) -> Robj

Convert a pairlist (LISTSXP) to a vector list (VECSXP).
Source§

fn vector_to_pair_list(&self) -> Robj

Convert a vector list (VECSXP) to a pair list (LISTSXP)
Source§

fn as_character_factor(&self) -> Robj

Convert a factor to a string vector.
Source§

fn alloc_matrix(sexptype: SEXPTYPE, rows: i32, cols: i32) -> Robj

Allocate a matrix object.
Source§

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>

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>

Find a variable in an environment. Read more
Source§

fn ncols(&self) -> usize

Number of columns of a matrix
Source§

fn nrows(&self) -> usize

Number of rows of a matrix
Source§

fn xlengthgets(&self, new_len: usize) -> Result<Robj>

Source§

fn alloc_vector(sexptype: SEXPTYPE, len: usize) -> Robj

Allocated an owned object of a certain type.
Source§

fn conformable(a: &Robj, b: &Robj) -> bool

Return true if two arrays have identical dims.
Source§

fn is_array(&self) -> bool

Return true if this is an array.
Source§

fn is_factor(&self) -> bool

Return true if this is factor.
Source§

fn is_frame(&self) -> bool

Return true if this is a data frame.
Source§

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

Return true if this is an integer vector (INTSXP) but not a factor.
Source§

fn is_language(&self) -> bool

Return true if this is a language object (LANGSXP).
Source§

fn is_pairlist(&self) -> bool

Return true if this is NILSXP or LISTSXP.
Source§

fn is_matrix(&self) -> bool

Return true if this is a matrix.
Source§

fn is_list(&self) -> bool

Return true if this is NILSXP or VECSXP.
Source§

fn is_number(&self) -> bool

Return true if this is INTSXP, LGLSXP or REALSXP but not a factor.
Source§

fn is_primitive(&self) -> bool

Return true if this is a primitive function BUILTINSXP, SPECIALSXP.
Source§

fn is_ts(&self) -> bool

Return true if this is a time series vector (see tsp).
Source§

fn is_user_binop(&self) -> bool

Return true if this is a user defined binop.
Source§

fn is_vector(&self) -> bool

Return true if this is a vector.
Source§

fn is_vector_atomic(&self) -> bool

Return true if this is an atomic vector.
Source§

fn is_vector_list(&self) -> bool

Return true if this is a vector list.
Source§

fn is_vectorizable(&self) -> bool

Return true if this is can be made into a vector.
Source§

fn is_raw(&self) -> bool

Return true if this is RAWSXP.
Source§

fn is_char(&self) -> bool

Return true if this is CHARSXP.
Source§

fn is_missing_arg(&self) -> bool

Source§

fn is_unbound_value(&self) -> bool

Source§

fn is_package_env(&self) -> bool

Source§

fn package_env_name(&self) -> Robj

Source§

fn is_namespace_env(&self) -> bool

Source§

fn namespace_env_spec(&self) -> Robj

Source§

fn is_altrep(&self) -> bool

Returns true if this is an ALTREP object.
Source§

fn is_altinteger(&self) -> bool

Returns true if this is an integer ALTREP object.
Source§

fn is_altreal(&self) -> bool

Returns true if this is an real ALTREP object.
Source§

fn is_altlogical(&self) -> bool

Returns true if this is an logical ALTREP object.
Source§

fn is_altraw(&self) -> bool

Returns true if this is a raw ALTREP object.
Source§

fn is_altstring(&self) -> bool

Returns true if this is an integer ALTREP object.
Source§

fn is_altlist(&self) -> bool

Returns true if this is an integer ALTREP object.
Source§

fn deparse(&self) -> Result<String>

Generate a text representation of this object.
Source§

impl Serialize for Robj

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Slices for Robj

Source§

unsafe fn as_typed_slice_raw<T>(&self) -> &[T]

Get an immutable slice to this object’s data. Read more
Source§

unsafe fn as_typed_slice_raw_mut<T>(&mut self) -> &mut [T]

Get a mutable slice to this object’s data. Read more
Source§

impl<Rhs> Sub<Rhs> for Robj
where Rhs: Into<Robj>,

Source§

fn sub(self, rhs: Rhs) -> Self::Output

Subtract two R objects, consuming the left hand side. panics on error.

use extendr_api::prelude::*;
test! {

// lhs and rhs get dropped here
let lhs = r!([10, 20]);
let rhs = r!([1, 2]);
assert_eq!(lhs - rhs, r!([9, 18]));

// lhs gets dropped and rhs is a temporary object.
let lhs = r!([1000, 2000]);
assert_eq!(lhs - 1, r!([999, 1999]));

// Only lhs gets dropped.
let lhs = r!([10, 20]);
let rhs = r!([1, 2]);
assert_eq!(lhs - &rhs, r!([9, 18]));
}
Source§

type Output = Robj

The resulting type after applying the - operator.
Source§

impl<A, S, D> TryFrom<&ArrayBase<S, D>> for Robj
where S: Data<Elem = A>, A: Copy + ToVectorValue, D: Dimension,

Source§

fn try_from(value: &ArrayBase<S, D>) -> Result<Self>

Converts a reference to an ndarray Array into an equivalent R array. The data itself is copied.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for &[Rbool]

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a logical object into a slice of Rbool (tri-state booleans). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for &[Rcplx]

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a complex object into a slice of Rcplx Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for &[Rfloat]

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a doubles object into a slice of Rfloat (tri-state booleans). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for &[Rint]

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert an integer object into a slice of Rint (tri-state booleans). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for &[f64]

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a REALSXP object into a slice of f64 (double precision floating point). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for &[i32]

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert an INTSXP object into a slice of i32 (integer). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for &[u8]

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a RAWSXP object into a slice of bytes.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<T> TryFrom<&Robj> for &ExternalPtr<T>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for &str

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a scalar STRSXP object into a string slice. NAs are not allowed.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Altrep

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<'a> TryFrom<&Robj> for ArrayView1<'a, c64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView2<'a, c64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView1<'a, Rbool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView2<'a, Rbool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView1<'a, Rcplx>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView2<'a, Rcplx>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView1<'a, Rfloat>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView2<'a, Rfloat>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView1<'a, Rint>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView2<'a, Rint>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView1<'a, Rstr>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView2<'a, Rstr>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView1<'a, f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView2<'a, f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView1<'a, i32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for ArrayView2<'a, i32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Complexes

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<T> TryFrom<&Robj> for Dataframe<T>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Doubles

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<'a, L, R> TryFrom<&'a Robj> for Either<L, R>
where L: TryFrom<&'a Robj, Error = Error>, R: TryFrom<&'a Robj, Error = Error>,

Source§

fn try_from(value: &'a Robj) -> Result<Self>

Returns the first type that matches the provided Robj, starting from L-type, and if that fails, then the R-type is converted.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Environment

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Expressions

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<T> TryFrom<&Robj> for ExternalPtr<T>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<&Robj> for FromList<Vec<T>>
where T: TryFrom<Robj>, <T as TryFrom<Robj>>::Error: Into<Error>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Function

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for HashMap<&str, Robj>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for HashMap<String, Robj>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Integers

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Language

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for List

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for ListIter

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a general R object into a List iterator if possible.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Logicals

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Mat<f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&Robj> for MatRef<'a, f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a, T> TryFrom<&'a Robj> for Nullable<T>
where T: TryFrom<&'a Robj, Error = Error>,

Source§

fn try_from(robj: &'a Robj) -> Result<Self, Self::Error>

Convert an object that may be null to a rust type.

use extendr_api::prelude::*;
test! {
    let s1 = r!(1);
    let n1 = <Nullable<i32>>::try_from(&s1)?;
    assert_eq!(n1, Nullable::NotNull(1));
    let snull = r!(NULL);
    let nnull = <Nullable<i32>>::try_from(&snull)?;
    assert_eq!(nnull, Nullable::Null);
}
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Option<&[Rbool]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<&[Rcplx]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<&[Rfloat]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<&[Rint]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<&[f64]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<&[i32]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<&[u8]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<&str>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<HashMap<&str, Robj>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<HashMap<String, Robj>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<&Robj> for Option<RColumn<T>>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<&Robj> for Option<RMatrix<T>>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<&Robj> for Option<RMatrix3D<T>>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Rbool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Rcplx>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Rfloat>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Rint>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<String>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Vec<Rbool>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Vec<Rcplx>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Vec<Rfloat>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Vec<Rint>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Vec<String>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Vec<f64>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Vec<i32>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<Vec<u8>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<bool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<f32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<i16>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<i32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<i64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<i8>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<isize>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<u16>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<u32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<u64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<u8>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Option<usize>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Pairlist

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for PairlistIter

Source§

fn try_from(robj: &Robj) -> Result<Self>

You can pass a PairlistIter to a function.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Primitive

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Promise

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<T> TryFrom<&Robj> for RColumn<T>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<&Robj> for RMatrix<T>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<&Robj> for RMatrix3D<T>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Raw

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Rbool

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert an LGLSXP object into a Rbool (tri-state boolean). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Rcplx

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Rfloat

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Rint

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for Rstr

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for S4

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for StrIter

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: &Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&Robj> for String

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert an scalar STRSXP object into a String. Note: Unless you plan to store the result, use a string slice instead. NAs are not allowed.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Strings

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Symbol

Source§

fn try_from(robj: &Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Vec<Rbool>

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a LGLSXP object into a vector of Rbool (tri-state booleans). Note: Unless you plan to store the result, use a slice instead. Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Vec<Rcplx>

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a complex object into a vector of Rcplx.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Vec<Rfloat>

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a REALSXP object into a vector of f64 (double precision floating point). Note: Unless you plan to store the result, use a slice instead. Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Vec<Rint>

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert an INTSXP object into a vector of i32 (integer). Note: Unless you plan to store the result, use a slice instead. Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Vec<String>

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a STRSXP object into a vector of Strings. Note: Unless you plan to store the result, use a slice instead.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Vec<f64>

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a REALSXP object into a vector of f64 (double precision floating point). Note: Unless you plan to store the result, use a slice instead. Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Vec<i32>

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert an INTSXP object into a vector of i32 (integer). Note: Unless you plan to store the result, use a slice instead. Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for Vec<u8>

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a RAWSXP object into a vector of bytes. Note: Unless you plan to store the result, use a slice instead.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for bool

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert an LGLSXP object into a boolean. NAs are not allowed.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for f32

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to a real value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for f64

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to a real value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for i16

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for i32

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for i64

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for i8

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for isize

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for u16

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for u32

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for u64

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for u8

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&Robj> for usize

Source§

fn try_from(robj: &Robj) -> Result<Self>

Convert a numeric object to an integer value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&mut Robj> for &mut [Rbool]

Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Convert a logical object into a mutable slice of Rbool (tri-state booleans). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&mut Robj> for &mut [Rcplx]

Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Convert a complex object into a mutable slice of Rcplx Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&mut Robj> for &mut [Rfloat]

Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Convert a doubles object into a mutable slice of Rfloat (tri-state booleans). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&mut Robj> for &mut [Rint]

Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Convert an integer object into a mutable slice of Rint (tri-state booleans). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&mut Robj> for &mut [f64]

Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Convert a REALSXP object into a mutable slice of f64 (double precision floating point). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&mut Robj> for &mut [i32]

Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Convert an INTSXP object into a mutable slice of i32 (integer). Use value.is_na() to detect NA values.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<&mut Robj> for &mut [u8]

Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Convert a RAWSXP object into a mutable slice of bytes.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<T> TryFrom<&mut Robj> for &mut ExternalPtr<T>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: &mut Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&mut Robj> for Option<&mut [Rbool]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&mut Robj> for Option<&mut [Rcplx]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&mut Robj> for Option<&mut [Rfloat]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&mut Robj> for Option<&mut [Rint]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&mut Robj> for Option<&mut [f64]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&mut Robj> for Option<&mut [i32]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&mut Robj> for Option<&mut [u8]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: &mut Robj) -> Result<Self>

Performs the conversion.
Source§

impl<A, S, D> TryFrom<ArrayBase<S, D>> for Robj
where S: Data<Elem = A>, A: Copy + ToVectorValue, D: Dimension,

Source§

fn try_from(value: ArrayBase<S, D>) -> Result<Self>

Converts an ndarray Array into an equivalent R array. The data itself is copied.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for &[Rbool]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &[Rcplx]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &[Rfloat]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &[Rint]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &[f64]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &[i32]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &[u8]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &mut [Rbool]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &mut [Rcplx]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &mut [Rfloat]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &mut [Rint]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &mut [f64]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &mut [i32]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &mut [u8]

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for &str

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Altrep

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<'a> TryFrom<Robj> for ArrayView1<'a, c64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView2<'a, c64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView1<'a, Rbool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView2<'a, Rbool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView1<'a, Rcplx>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView2<'a, Rcplx>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView1<'a, Rfloat>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView2<'a, Rfloat>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView1<'a, Rint>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView2<'a, Rint>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView1<'a, Rstr>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView2<'a, Rstr>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView1<'a, f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView2<'a, f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView1<'a, i32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for ArrayView2<'a, i32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Complexes

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<T> TryFrom<Robj> for Dataframe<T>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Doubles

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<L, R> TryFrom<Robj> for Either<L, R>
where for<'a> Either<L, R>: TryFrom<&'a Robj, Error = Error>,

Source§

fn try_from(value: Robj) -> Result<Self>

Returns the first type that matches the provided Robj, starting from L-type, and if that fails, then the R-type is converted.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Environment

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Expressions

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<T> TryFrom<Robj> for ExternalPtr<T>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<Robj> for FromList<Vec<T>>
where T: TryFrom<Robj>, <T as TryFrom<Robj>>::Error: Into<Error>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Function

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for HashMap<&str, Robj>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for HashMap<String, Robj>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Integers

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Language

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for List

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for ListIter

Source§

fn try_from(robj: Robj) -> Result<Self>

Convert a general R object into a List iterator if possible.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Logicals

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Mat<f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<Robj> for MatRef<'a, f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<Robj> for Nullable<T>
where T: TryFrom<Robj, Error = Error>,

Source§

fn try_from(robj: Robj) -> Result<Self, Self::Error>

Convert an object that may be null to a rust type.

use extendr_api::prelude::*;
test! {
    let s1 = r!(1);
    let n1 = <Nullable<i32>>::try_from(s1)?;
    assert_eq!(n1, Nullable::NotNull(1));
    let snull = r!(NULL);
    let nnull = <Nullable<i32>>::try_from(snull)?;
    assert_eq!(nnull, Nullable::Null);
}
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Option<&[Rbool]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&[Rcplx]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&[Rfloat]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&[Rint]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&[f64]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&[i32]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&[u8]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&mut [Rbool]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&mut [Rcplx]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&mut [Rfloat]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&mut [Rint]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&mut [f64]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&mut [i32]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&mut [u8]>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<&str>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<HashMap<&str, Robj>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<HashMap<String, Robj>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<Robj> for Option<RColumn<T>>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<Robj> for Option<RMatrix<T>>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<Robj> for Option<RMatrix3D<T>>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Rbool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Rcplx>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Rfloat>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Rint>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<String>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Vec<Rbool>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Vec<Rcplx>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Vec<Rfloat>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Vec<Rint>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Vec<String>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Vec<f64>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Vec<i32>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<Vec<u8>>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<bool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<f32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<i16>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<i32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<i64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<i8>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<isize>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<u16>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<u32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<u64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<u8>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Option<usize>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Pairlist

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Primitive

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Promise

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl<T> TryFrom<Robj> for RColumn<T>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<Robj> for RMatrix<T>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<Robj> for RMatrix3D<T>
where Robj: for<'a> AsTypedSlice<'a, T>,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Raw

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Rbool

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Rcplx

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Rfloat

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Rint

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Rstr

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for S4

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for StrIter

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for String

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Strings

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Symbol

Source§

fn try_from(robj: Robj) -> Result<Self>

Make a wrapper from a robj if it matches.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<Robj> for Vec<Rbool>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Vec<Rcplx>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Vec<Rfloat>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Vec<Rint>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Vec<String>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Vec<f64>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Vec<i32>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for Vec<u8>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for bool

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for f32

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for f64

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for i16

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for i32

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for i64

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for i8

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for isize

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for u16

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for u32

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for u64

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for u8

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Robj> for usize

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
Source§

impl Types for Robj

Source§

fn rtype(&self) -> Rtype

Get the type of an R object. Read more
Source§

fn as_any(&self) -> Rany<'_>

Source§

impl<'de> VariantAccess<'de> for &'de Robj

Source§

type Error = Error

The error type that can be returned if some error occurs during deserialization. Must match the error type of our EnumAccess.
Source§

fn unit_variant(self) -> Result<()>

Called when deserializing a variant with no values. Read more
Source§

fn newtype_variant_seed<T>(self, seed: T) -> Result<T::Value>
where T: DeserializeSeed<'de>,

Called when deserializing a variant with a single value. Read more
Source§

fn tuple_variant<V>(self, _len: usize, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Called when deserializing a tuple-like variant. Read more
Source§

fn struct_variant<V>( self, _fields: &'static [&'static str], visitor: V, ) -> Result<V::Value>
where V: Visitor<'de>,

Called when deserializing a struct-like variant. Read more
Source§

fn newtype_variant<T>(self) -> Result<T, Self::Error>
where T: Deserialize<'de>,

Called when deserializing a variant with a single value. Read more

Auto Trait Implementations§

§

impl Freeze for Robj

§

impl RefUnwindSafe for Robj

§

impl !Send for Robj

§

impl !Sync for Robj

§

impl Unpin for Robj

§

impl UnwindSafe for Robj

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRobj for T
where Robj: From<T>,

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R> Save for R
where R: GetSexp,

Source§

fn save<P: AsRef<Path>>( &self, path: &P, format: PstreamFormat, version: i32, hook: Option<WriteHook>, ) -> Result<()>

Save an object in the R data format. version should probably be 3.
Source§

fn to_writer<W: Write>( &self, writer: &mut W, format: PstreamFormat, version: i32, hook: Option<WriteHook>, ) -> Result<()>

Save an object in the R data format to a Write trait. version should probably be 3.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,