pub trait ColumnarFrame<Row>: Sized {
// Required method
fn from_rows(rows: Vec<Row>) -> Self;
// Provided method
fn into_rows(self) -> Vec<Row>
where Self: IntoIterator<Item = Row> { ... }
}Expand description
Rust rows ↔ the pure-Rust columnar companion generated by #[derive(DataFrameRow)].
#[derive(DataFrameRow)] builds a companion struct (<Row>DataFrame) whose fields are
Vec-columns — the in-memory, column-oriented form of Vec<Row>. This trait is the
documented verb surface for that companion: build it from rows (sequentially, or in parallel
with feature = "rayon") and, for row-iterable companions, read the rows back.
It is the pure-Rust complement to IntoDataFrame / FromDataFrame, which cross the R
boundary (Vec<Row> ↔ R data.frame). In particular from_rows_par
(feature = "rayon") builds the pure-Rust companion in parallel —
IntoDataFrame::into_dataframe_par cannot, since it yields an R-backed
BuiltDataFrame rather than the companion.
The derive implements this on the companion type; call CompanionType::from_rows(rows).
Row is a type parameter (not an associated type) so the derive can implement it for a
pub companion even when the row type is private — mirroring From<Vec<Row>>, and
avoiding the private-type-in-public-interface error an associated type would raise.
§Reading rows back
into_rows is available for row-iterable companions
(named-field structs without column expansion), where it defers to the companion’s
IntoIterator. Enum and column-expansion companions are write-only in pure Rust; read
those back across the R boundary via FromDataFrame or the derive’s one-call
try_from_dataframe.
Required Methods§
Provided Methods§
Sourcefn into_rows(self) -> Vec<Row>where
Self: IntoIterator<Item = Row>,
fn into_rows(self) -> Vec<Row>where
Self: IntoIterator<Item = Row>,
Read the rows back out of the companion.
Available for row-iterable companions (named-field structs without column expansion);
defers to the companion’s IntoIterator. Enum and column-expansion companions are
write-only in pure Rust — read those back via FromDataFrame / try_from_dataframe.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".