extendr_api::robj

Trait Length

Source
pub trait Length: GetSexp {
    // Provided methods
    fn len(&self) -> usize { ... }
    fn is_empty(&self) -> bool { ... }
}

Provided Methods§

Source

fn len(&self) -> usize

Get the extended length of the object.

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

let a : Robj = r!(vec![1., 2., 3., 4.]);
assert_eq!(a.len(), 4);
}
Source

fn is_empty(&self) -> bool

Returns true if the Robj contains no elements.

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

let a : Robj = r!(vec![0.; 0]); // length zero of numeric vector
assert_eq!(a.is_empty(), true);
}

Implementors§

Source§

impl Length for Altrep

len() and is_empty()

Source§

impl Length for Complexes

len() and is_empty()

Source§

impl Length for Doubles

len() and is_empty()

Source§

impl Length for Environment

len() and is_empty()

Source§

impl Length for Expressions

len() and is_empty()

Source§

impl Length for Function

len() and is_empty()

Source§

impl Length for Integers

len() and is_empty()

Source§

impl Length for Language

len() and is_empty()

Source§

impl Length for List

len() and is_empty()

Source§

impl Length for Logicals

len() and is_empty()

Source§

impl Length for Pairlist

len() and is_empty()

Source§

impl Length for Primitive

len() and is_empty()

Source§

impl Length for Promise

len() and is_empty()

Source§

impl Length for Raw

len() and is_empty()

Source§

impl Length for Rstr

len() and is_empty()

Source§

impl Length for S4

len() and is_empty()

Source§

impl Length for Strings

len() and is_empty()

Source§

impl Length for Symbol

len() and is_empty()

Source§

impl Length for Robj

Source§

impl<T> Length for Dataframe<T>

len() and is_empty()

Source§

impl<T> Length for ExternalPtr<T>

len() and is_empty()