Design code to work correctly with any combination of feature flags. When implementing conditional compilation with feature flags: 1. Use conditional imports for dependencies that are only needed when certain features are enabled:
Design code to work correctly with any combination of feature flags. When implementing conditional compilation with feature flags:
// Bad: Requiring dependencies unconditionally use polars_core::{POOL, StringCacheHolder}; // Breaks when “new_streaming” is disabled
2. Consider user scenarios with different feature combinations. Test both with and without features enabled.
3. Ensure error messages reference correct feature names:
```rust
// Good: Reference the correct feature name
polars_bail!(
ComputeError: "consider compiling with polars-bigidx feature, or set 'streaming'"
)
// Bad: Referencing incorrect feature name
polars_bail!(
ComputeError: "consider compiling with polars-u64-idx feature, or set 'streaming'"
)
When adding code conditionally compiled with feature flags, check that the code still compiles and functions correctly when those features are disabled.
Consider organizing feature-dependent code to minimize duplication while maintaining compatibility with all feature combinations.
Enter the URL of a public GitHub repository