Search code examples
rustdependenciesrust-cargorust-polars

How to enable only a subset of Polars' crate features?


I am using Polars in Rust. I have noticed that compile times drop significantly and give a smaller binary when using the polars-core crate instead of the polars crate. However, it's discouraged to use this "internal" crate.

In my Cargo.toml I specify my Polars deps as:

polars = { version = "0.41.0", features = ["dtype-struct", "lazy", "timezones"] }

Is it possible to include only the subset of features in the polars crate that I'm actually using?


Solution

  • Crates can have some features enabled by default. To disable those features, you can pass default-features = false as an option for that dependency in your Cargo.toml:

    [dependencies]
    polars = { version = "0.41.0", default-features = false }
    

    This will disable all default features and you can then enable the features you want with features = ["dtype-struct", ...].

    Documentation