pub fn derive_dataframe_row(input: DeriveInput) -> Result<TokenStream>Expand description
Derive DataFrameRow: generates a companion DataFrame type with collection fields.
§Requirements
For structs: the type must implement IntoList.
For enums: all variants must have named fields.
§Generated Items
For a struct Measurement { time: f64, value: f64 }:
- Struct
MeasurementDataFrame { time: Vec<f64>, value: Vec<f64> } impl IntoDataFrame for MeasurementDataFrame(rows → Rdata.frame)impl ColumnarFrame for MeasurementDataFrame(rows ↔ the pure-Rust companion)impl From<Vec<Measurement>> for MeasurementDataFrameimpl IntoIterator for MeasurementDataFrame
For an enum:
- Companion struct with
Vec<Option<T>>columns (field-name union) - Optional tag column for variant discrimination
impl From<Vec<Enum>> for EnumDataFrameimpl IntoDataFrame for EnumDataFrameimpl ColumnarFrame for EnumDataFrameimpl DataFrameRowSplit for Enum(the split representation behindIntoDataFrameSplit)
§Public surface (which verbs to call)
- Rows → R
data.frame:rows.into_dataframe()?(/_par) orrows.wrap_data_frame(), fromIntoDataFrame/AsDataFrameExt. - R
data.frame→ rows:Vec::<Row>::from_dataframe(&df)?(/_par) fromFromDataFrame, or the one-callRow::try_from_dataframe(sexp)reader. - Rows ↔ the pure-Rust columnar companion: the
ColumnarFrametrait (<Row>DataFrame::from_rows/from_rows_par/into_rows), or thestdVec<Row>: Into<companion>/ companionIntoIterator. - Enums:
rows.into_dataframe_split()(onedata.frameper variant) fromIntoDataFrameSplit, implemented via the hiddenDataFrameRowSplitbridge on the enum type.
All the traits above are re-exported from miniextendr_api::prelude. The row
type also carries two #[doc(hidden)] helpers: to_dataframe(rows) -> companion,
retained only because the struct-flatten / nested-enum write paths build a
nested companion via Inner::to_dataframe(..) without naming its type, and
to_dataframe_split(rows), the body holder behind the DataFrameRowSplit bridge.
§Attributes
#[dataframe(name = "CustomName")]— Custom companion type name#[dataframe(align)]— Enum alignment mode (accepted but implicit)#[dataframe(tag = "col")]— Add variant discriminator column