Skip to main content

AtomicElement

Trait AtomicElement 

Source
pub trait AtomicElement: Sized {
    // Required methods
    fn vec_to_sexp(values: Vec<Self>) -> SEXP;
    fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>;
}
Expand description

Marker trait for types that can be elements of named atomic R vectors.

Each implementation knows how to convert Vec<Self> to/from an R atomic vector (INTSXP, REALSXP, LGLSXP, RAWSXP, or STRSXP).

Required Methods§

Source

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Convert a Rust vector to an R atomic SEXP.

Source

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Convert an R atomic SEXP to a Rust vector.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AtomicElement for Option<bool>

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Source§

impl AtomicElement for Option<f64>

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Source§

impl AtomicElement for Option<i32>

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Source§

impl AtomicElement for Option<String>

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Source§

impl AtomicElement for bool

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Source§

impl AtomicElement for f64

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Source§

impl AtomicElement for i32

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Source§

impl AtomicElement for u8

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Source§

impl AtomicElement for String

Source§

fn vec_to_sexp(values: Vec<Self>) -> SEXP

Source§

fn vec_from_sexp(sexp: SEXP) -> Result<Vec<Self>, SexpError>

Implementors§