#[doc(hidden)]pub trait ColumnSource {
// Required method
fn into_column_list(self) -> List;
// Provided methods
unsafe fn into_named_columns(
self,
scope: &ProtectScope,
) -> 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<BuiltDataFrame, _>) 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§
Sourceunsafe fn into_named_columns(self, scope: &ProtectScope) -> Vec<(String, SEXP)>where
Self: Sized,
unsafe fn into_named_columns(self, scope: &ProtectScope) -> Vec<(String, SEXP)>where
Self: Sized,
Extract named column SEXPs from this value.
Returns (name, raw SEXP) per column. The assembled column list is
protected in scope before anything is read from it, so every returned
SEXP stays reachable (as an element of that list) for as long as scope
lives, across any number of later allocations (#1748).
§Safety
Must run on the R main thread, and scope must be the innermost live
ProtectScope: its Drop unprotects
from the top of R’s protect stack.
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".