Struct extendr_api::robj::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]));
}
§

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, u32> for Robj
where Self: 'a,

source§

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

source§

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

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<Robj>
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 names.
source§

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

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

Set the class attribute from a string iterator, and returns 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

§

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]));
}
§

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

§

type Error = Error

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

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: Any + Debug> 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<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<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<'a> FromRobj<'a> for Robj

Pass-through Robj conversion, essentially a clone.

source§

fn from_robj(robj: &'a Robj) -> Result<Self, &'static str>

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<'a, E: 'a>(&self) -> Option<RColumn<E>>
where Robj: AsTypedSlice<'a, E>,

source§

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

source§

fn as_matrix3d<'a, E: 'a>(&self) -> Option<RMatrix3D<E>>
where Robj: 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]));
}
§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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: u32) -> 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 eval_promise(&self) -> Result<Robj>

If this object is a promise, evaluate it, otherwise return the object. 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: u32, 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_valid_string(&self) -> bool

Return true if this is a valid string.
source§

fn is_valid_string_f(&self) -> bool

Return true if this is a valid string.
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]));
}
§

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.

§

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.

§

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 Rbool Use value.is_na() to detect NA values.

§

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.

§

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.

§

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.

§

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.

§

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.

§

type Error = Error

The type returned in the event of a conversion error.
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.

§

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.

§

type Error = Error

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

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

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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

§

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

§

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.

§

type Error = Error

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

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

§

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.

§

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.

§

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.

§

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.

§

type Error = Error

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

impl<T: Any + Debug> TryFrom<&Robj> for ExternalPtr<T>

§

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

§

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.

§

type Error = Error

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

impl TryFrom<&Robj> for Integers

source§

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

Make a wrapper from a robj if it matches.

§

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.

§

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.

§

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.

§

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.

§

type Error = Error

The type returned in the event of a conversion error.
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);
}
§

type Error = Error

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

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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.

§

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.

§

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.

§

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.

§

type Error = Error

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

impl TryFrom<&Robj> for Raw

source§

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

Make a wrapper from a robj if it matches.

§

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.

§

type Error = Error

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

impl TryFrom<&Robj> for Rcplx

§

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

§

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

§

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.

§

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.

§

type Error = Error

The type returned in the event of a conversion error.
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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

type Error = Error

The type returned in the event of a conversion error.
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.

§

type Error = Error

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

impl TryFrom<Robj> for &[Rbool]

§

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]

§

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]

§

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]

§

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]

§

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]

§

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]

§

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

§

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.

§

type Error = Error

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

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

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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

§

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

§

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.

§

type Error = Error

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

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

§

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.

§

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.

§

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.

§

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.

§

type Error = Error

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

impl<T: Any + Debug> TryFrom<Robj> for ExternalPtr<T>

§

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

§

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.

§

type Error = Error

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

impl TryFrom<Robj> for Integers

source§

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

Make a wrapper from a robj if it matches.

§

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.

§

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.

§

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.

§

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.

§

type Error = Error

The type returned in the event of a conversion error.
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);
}
§

type Error = Error

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

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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.

§

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.

§

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.

§

type Error = Error

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

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

§

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: 'a> TryFrom<Robj> for RMatrix<T>
where Robj: AsTypedSlice<'a, T>,

§

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: 'a> TryFrom<Robj> for RMatrix3D<T>
where Robj: AsTypedSlice<'a, T>,

§

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.

§

type Error = Error

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

impl TryFrom<Robj> for Rbool

§

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

§

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

§

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

§

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.

§

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.

§

type Error = Error

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

impl TryFrom<Robj> for String

§

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.

§

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.

§

type Error = Error

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

impl TryFrom<Robj> for Vec<Rbool>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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>

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

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,

§

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

§

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

§

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