Expand description
§List and Preference Derive Macros
This module implements derive macros for bidirectional Rust struct <-> R list
conversion, plus “preference” derives that control how a type is converted to R
when returned from #[miniextendr] functions.
§List Derives
#[derive(IntoList)]– Rust struct -> R named/unnamed list#[derive(TryFromList)]– R list -> Rust struct
§Preference Derives
These marker derives select the IntoR strategy for a type. Only one
preference derive should be applied to a given type:
#[derive(PreferList)]– convert viaIntoList::into_list#[derive(PreferExternalPtr)]– wrap inExternalPtr::new#[derive(PreferDataFrame)]– convert viaIntoDataFrame::into_data_frame#[derive(PreferRNativeType)]– convert viaAsRNativewrapper
§Field Attributes
#[into_list(ignore)]– skip this field during IntoList/TryFromList conversion. ForTryFromList, ignored fields are filled withDefault::default().
Functions§
- derive_
into_ list - Derive
IntoListfor structs (Rust -> R). - derive_
prefer_ data_ frame - Derive
PreferDataFrame: adds thePrefersDataFramemarker trait and anIntoRimpl that converts to R viaIntoDataFrame::into_data_frame, theninto_sexp. - derive_
prefer_ externalptr - Derive
PreferExternalPtr: adds thePrefersExternalPtrmarker trait and anIntoRimpl that wraps the value inExternalPtr::newbefore converting to SEXP. - derive_
prefer_ list - Derive
PreferList: adds thePrefersListmarker trait and anIntoRimpl that converts to R by first callingIntoList::into_list, theninto_sexp. - derive_
prefer_ rnative - Derive
PreferRNativeType: adds thePrefersRNativeTypemarker trait and anIntoRimpl that wraps the value inAsRNative(self)before callingIntoR::into_sexp. - derive_
try_ from_ list - Derive
TryFromListfor structs (R -> Rust). - field_
is_ 🔒ignored - Check whether a struct field has the
#[into_list(ignore)]attribute.