#[doc(hidden)]pub trait ColumnSource {
// Required method
fn into_column_list(self) -> List;
// Provided methods
fn into_named_columns(self) -> Vec<(String, SEXP)>
where Self: Sized { ... }
fn into_dataframe(self) -> Result<DataFrame, DataFrameError>
where Self: Sized { ... }
}Expand description
Internal engine that turns a value into a data.frame-shaped List.
This was the historical public convert::IntoDataFrame (-> List). It is now an internal
engine: the public IntoDataFrame (-> Result<DataFrame, _>) and the enum-flatten
codegen both delegate to it. Not part of the public verb surface.
Required Methods§
Sourcefn into_column_list(self) -> List
fn into_column_list(self) -> List
Convert into a data.frame-shaped List (named columns, data.frame class,
row.names).
Provided Methods§
Sourcefn into_named_columns(self) -> Vec<(String, SEXP)>where
Self: Sized,
fn into_named_columns(self) -> Vec<(String, SEXP)>where
Self: Sized,
Extract named column SEXPs from this value.
Returns (name, raw SEXP) per column. The SEXPs are owned by the produced
data-frame SEXP and must be protected by the caller before it is released.
§Safety
Calls R API functions; must run on the R main thread.
Sourcefn into_dataframe(self) -> Result<DataFrame, DataFrameError>where
Self: Sized,
fn into_dataframe(self) -> Result<DataFrame, DataFrameError>where
Self: Sized,
Assemble this source into a validated DataFrame.
The column engine always sets the data.frame class (even for an empty frame); the one
exception is the unnamed-row degradation, which returns a bare unclassed empty list — the
old panic!("unnamed list elements") case, now a clean Err(UnnamedColumns).
This is the bridge from the internal column-assembly engine to the public DataFrame.
We deliberately do not offer a blanket impl<T: ColumnSource> IntoDataFrame for T:
#[derive(DataFrameRow)] emits a concrete impl IntoDataFrame for Vec<Row> per row
type (and serde uses the SerdeRows<T> newtype), so a generic for T blanket would
coherence-conflict with every one of those (the compiler treats Vec<Row>: ColumnSource
as possibly-true). The derive’s into_dataframe glue calls this method instead.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".