Expand description
Derive macros for bidirectional row β dataframe conversions.
Supports both structs (direct field mapping) and enums (field-name union
across variants with Option<T> fill for missing fields).
ModulesΒ§
- enum_
expansion π - Enum-specific DataFrame derive expansion.
StructsΒ§
- Auto
Expand πVecData - Data for
ResolvedField::AutoExpandVec. - Column
Registry π - Accumulates unique columns for an enum-to-dataframe unified schema.
- Data
Frame πAttrs - Parsed container-level
#[dataframe(...)]attributes. - Enum
Auto πExpand VecData - Data for
EnumResolvedField::AutoExpandVec. - Enum
Expanded πFixed Data - Data for
EnumResolvedField::ExpandedFixed. - Enum
Expanded πVecData - Data for
EnumResolvedField::ExpandedVec. - Enum
MapField πData - Data for
EnumResolvedField::Map. - Enum
Single πField Data - Data for
EnumResolvedField::Single. - Enum
Struct πField Data - Data for
EnumResolvedField::Struct. - Expanded
Fixed πData - Data for
ResolvedField::ExpandedFixed. - Expanded
VecData π - Data for
ResolvedField::ExpandedVec. - Field
Attrs π - Parsed field-level
#[dataframe(...)]attributes. - MapField
Data π - Data for
ResolvedField::Map(struct path, non-String-keyed maps, #919). - Resolved
Column π - A resolved column in the unified schema across all enum variants.
- Single
Field πData - Data for
ResolvedField::Single. - Struct
Field πData - Data for
ResolvedField::Struct. - Variant
Info π - Parsed and resolved information about a single enum variant for DataFrame codegen.
EnumsΒ§
- Enum
Resolved πField - A resolved enum field ready for codegen β either a single column or expanded from an array/Vec into multiple suffixed columns.
- Field
Type πKind - Classification of a field type for DataFrame column expansion.
- Resolved
Field π - A resolved struct field ready for codegen β determines how this field maps to DataFrame companion struct columns.
- Variant
Shape π - Describes the shape of an enum variantβs fields.
ConstantsΒ§
- OPTION_
SCALAR_ πNAMES - Scalar types accepted inside
Option<β¦>as a struct-path field (#1437): everyThere hasIntoR for Vec<Option<T>>(typedNAforNone) inminiextendr-api::into_r. The reader side is gated separately byis_reader_scalar_ty, soOption<u64>/Option<usize>fields are write-only, like their bare counterparts. - READER_
SCALAR_ πNAMES - Scalar element types whose
Vec<T>(andVec<Option<T>>) round-trips throughTryFromSexpβ the supported field types for the parallel from-R reader (try_from_dataframe_par). This is intentionally narrower thanFieldTypeKind::Scalar: set/opaque collection types (HashSet<β¦>,BTreeSet<β¦>) also classify asScalarbut do NOT implementVec<_>: TryFromSexp, so they must be excluded from the reader path.
FunctionsΒ§
- classify_
field_ πtype - Classify a field type for DataFrame column expansion.
- column_
sexp π - Convert a companion column without adding R objects to the companion:
as_listuses the rooted list builder,as_factorusesUnitEnumFactor, and ordinary columns convert the wholeVecthroughIntoR. - companion_
debug_ πclone DebugandClonefor a companion, each implemented only when every field type has it.#[derive(Debug, Clone)]would demand both of every columnβs element type (#2013).fieldsare the companionβs fields with their types.- companion_
lifetime_ πmarker - Keep lifetimes erased by column expansion or skipped fields in the companion. Columns that still borrow already carry their lifetimes; only missing ones need a marker. This adds no data column or element-type trait requirements.
- conditional_
where π whereclause:where_clauseβs predicates, thenfor<'__mx_cond> ty: boundfor each(ty, bound)pair.- derive_
dataframe_ row - Derive
DataFrameRow: generates a companion DataFrame type with collection fields. - derive_
struct_ πdataframe - Generate
DataFrameRowexpansion for struct types. - expanded_
elem_ πidents - The variables
fixed_array_elems/width_elemsbind for thencolumns of the fieldkeynames. Leading underscores are dropped fromkeyso the variables stay snake case (_0gives__mxe1_0). - field_
is_ πborrowed_ ref - True if
tyis a borrowed reference (&[T],&[T; N],&str, β¦). Such expansion fields canβt be reconstructed by value in the RβRust reader. - field_
reader_ πcapable - True if a resolved struct field can be read back out of an R
data.frame. - fixed_
array_ πelems - Bind each element of fixed-array field value
accessto its own variable inelems: moved out of an owned array (indexing would needCopy), cloned out of a borrowed one, which is the only way to own an element behind a reference. - from_
rows_ πpar_ override - The
from_rows_paroverride of a companionβsColumnarFrameimpl: the companionβsParallelColumnsimpl where it applies,from_rowsotherwise (miniextendr_api::dataframe::FromRowsParProbe). - generic_
type_ πarg_ count - Number of type arguments on
tyβs last path segment (0 when not angle-bracketed). RejectsHashMap<K, V, S>custom-hasher maps from the reader path β theVec<HashMap<String, V>>: TryFromSexpimpl only covers the default hasher. - is_
bare_ πreader_ scalar_ ty - True if
tynames a known scalar, qualified or bare (noOptionor generics). - is_
known_ πscalar_ ty - Match the final scalar name, as field classification does. Absolute and relative paths have the same conversion support; associated types and generic payloads still need their own classification.
- is_
option_ πscalar_ inner - True if
tynames a type fromOPTION_SCALAR_NAMES(possibly qualified, without generic args), a valid payload for a single NA-able column. - is_
raw_ πscalar_ ty - True if
tyisu8, bare or qualified. R stores it in a raw vector, which has no NA, so au8column cannot pad or omit cells (Vec<Option<u8>>has noIntoR). - is_
reader_ πscalar_ ty - True if
tyis a known scalar path, orOption<known-scalar>. - is_
string_ πty - True if
tyβs last path segment is the bare identString(path-identity check, same convention asclassify_field_type). - list_
column_ πfn into_list_column::<#ty>(orinto_option_list_column::<#ty>, for a column with absent rows), spanned at the field type: a type withoutIntoListis then reported at the field instead of at the derive.- option_
payload π - The payload of
Option<T>(possibly qualified), iftyis one. - owned_
elems_ πiter - The elements of an expanded
Vec<T>/Box<[T]>/&[T]field valueaccessas an iterator of ownedT: moved out of an owned container, cloned out of a borrowed slice.IntoIterator::into_iteris called by path so aBox<[T]>iterates by value in every edition. - parallel_
columns_ πimpl - The parallel column fill of a companion:
ParallelColumnswithbodyasfrom_rows_parallel(rows), implemented only whereboundshold (seeminiextendr_api::dataframe::ParallelColumns). Emitted only when miniextendr-api hasrayon; pair it withfrom_rows_par_override. - parse_
dataframe_ πattrs - Parse container-level
#[dataframe(...)]attributes from the derive input. - parse_
field_ πattrs - Parse field-level
#[dataframe(...)]attributes from asyn::Field. - raw_
na_ πcolumn_ error - A
u8in a column whose cells can be NA.whynames the source of the NA cells andfixthe alternative, so the error points at the field instead of the missingIntoRimpl inside the generated code (#2025). - resolve_
struct_ πfield - Resolve a struct field into a
ResolvedField, applying field attributes. - spanned_
clone_ πfn <ty as Clone>::clone, spanned atty: a type withoutCloneis then reported at the userβs field instead of at the derive.- validate_
factor_ πfield_ type - The same
as_factorshapes are accepted on struct and enum fields. The generated conversion checksUnitEnumFactoron the selected type. - width_
elems π - Bind the first
elems.len()elements of awidth = Nfield valueaccesstoOption<T>variables (Nonepast its end; elements pastNare dropped), through iterator variableiter.