Skip to main content

Crate df_derive

Crate df_derive 

Source
Expand description

User-facing facade for deriving Polars DataFrame conversions.

Most users should depend on this crate, import the prelude, and derive ToDataFrame without any runtime-path attributes:

[dependencies]
df-derive = "0.3"
polars = "0.53"

The default facade hides the macro’s polars-arrow implementation dependency behind df_derive::dataframe; custom runtimes still need to provide their own compatible direct dependencies.

use df_derive::prelude::*;

#[derive(ToDataFrame)]
struct Trade {
    symbol: String,
    price: f64,
    size: u64,
}

The derive macro targets dataframe by default, which is re-exported from df-derive-core. Power users can depend on df-derive-macros directly or use #[df_derive(trait = "...")], #[df_derive(columnar = "...")], and #[df_derive(decimal128_encode = "...")] to target a custom runtime. Explicit paths back to df_derive::dataframe::ToDataFrame or df_derive_core::dataframe::ToDataFrame still use the default runtime’s hidden dependency re-exports.

Modules§

dataframe
prelude
Common imports for normal users.

Derive Macros§

ToDataFrame
Derive ToDataFrame for structs and tuple structs to generate fast conversions to Polars.