Skip to main content

DataFrameRowConvert

Trait DataFrameRowConvert 

Source
#[doc(hidden)]
pub trait DataFrameRowConvert: Sized { // Required method fn rows_into_dataframe(rows: Vec<Self>) -> Result<DataFrame, DataFrameError>; // Provided method fn rows_from_dataframe( _df: &DataFrame, ) -> Option<Result<Vec<Self>, DataFrameError>> { ... } }
Expand description

Row → DataFrame conversion glue emitted by #[derive(DataFrameRow)] on the row type.

The orphan rule forbids the derive from writing impl IntoDataFrame for Vec<Row> in the user crate: both IntoDataFrame and Vec are foreign there, and Row only appears covered inside Vec<_>, so there is no uncovered local type. Instead the derive implements this #[doc(hidden)] trait on the local Row type (legal — Row is local), and miniextendr_api carries the blanket IntoDataFrame / FromDataFrame impls for Vec<T: DataFrameRowConvert> below (legal — IntoDataFrame is local here). Users still call the public rows.into_dataframe()? / Vec::<Row>::from_dataframe(&df)? verbs.

Required Methods§

Source

fn rows_into_dataframe(rows: Vec<Self>) -> Result<DataFrame, DataFrameError>

Build a DataFrame from a row vector (sequential).

Provided Methods§

Source

fn rows_from_dataframe( _df: &DataFrame, ) -> Option<Result<Vec<Self>, DataFrameError>>

Read a row vector out of a DataFrame. None means this row shape has no reader (scalar, column-expansion, and struct-flatten struct shapes do; tagged enum shapes with reader-capable fields do too; tagless/map-column/coerced/skip/as_list enum shapes and opaque-map shapes do not); the blanket surfaces that as a clear error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§