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 viaColumnSource::into_column_list#[derive(PreferRNativeType)]– convert viaAsRNativewrapper
Stacking two of them is a conflict: each derive emits a fixed-name marker const
(prefer_conflict_marker), so a second Prefer* produces a guided
“duplicate definitions” error pointing at the call-site As* wrappers as the
way to choose a representation per return value (see #870).
§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: emits anIntoRimpl that converts to R viaColumnSource::into_column_list, theninto_sexp. - derive_
prefer_ externalptr - Derive
PreferExternalPtr: emits anIntoRimpl that wraps the value inExternalPtr::newbefore converting to SEXP. - derive_
prefer_ list - Derive
PreferList: emits anIntoRimpl that converts to R by first callingIntoList::into_list, theninto_sexp. - derive_
prefer_ rnative - Derive
PreferRNativeType: emits 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. - prefer_
conflict_ 🔒marker - Emit a fixed-name conflict marker so that stacking two
Prefer*derives on a single type produces a guided compile error instead of a crypticE0119conflicting-IntoR-implementation error.