Cargo feature flags let you opt in to optional capabilities without pulling in dependencies you don’t need.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nimdeveloper/better-duck/llms.txt
Use this file to discover all available pages before exploring further.
better-duck uses feature flags extensively because it targets a wide range of environments — from Tauri desktop apps and iOS cross-builds to server-side async services and data-pipeline tools — and because some of its optional dependencies (like tokio or chrono) are large enough that you may want to exclude them. This page lists every feature flag for both better-duck-core and better-duck-diesel, explains what each one enables, and notes which are on by default.
better-duck-core Features
Thebetter-duck-core crate is the low-level DuckDB wrapper. Its feature flags control date/time conversions, decimal support, extensions, async, pooling, and user-defined functions.
| Feature | Default | Description |
|---|---|---|
chrono | ✓ | Enable chrono date/time conversions for DATE, TIME, TIMESTAMP, TIMESTAMPTZ, TIME_TZ, TIME_NS, and INTERVAL. When enabled, temporal DuckValue variants carry chrono types. When disabled, they carry types from better_duck_core::types::date_native and std::time. |
decimal | ✓ | Enable rust_decimal::Decimal support for DECIMAL columns. Adds the DuckValue::Decimal variant and impl AppendAble for Decimal. |
json | — | Enable DuckDB’s JSON extension. Needed only if you use json_extract, to_json, or other JSON functions in your queries. |
parquet | — | Enable DuckDB’s Parquet extension. Needed only if you use read_parquet(…) or other Parquet functions in your queries. |
async | — | Tokio-based async facade over spawn_blocking: adds AsyncConnection, AsyncDatabase, and AsyncPool. These types never block the async executor. Requires tokio with the rt feature. |
pool | — | r2d2 connection pool backed by a shared Database handle. Adds DuckDbConnectionManager and re-exports r2d2::Pool. Unlike opening N independent connections, every pooled connection shares the same underlying database, which is important for in-memory databases. |
udf | — | #[duckdb_scalar] and #[duckdb_table_function] proc-macro attributes for registering plain Rust functions as DuckDB scalar or table functions. Adds the better-duck-macros proc-macro crate as a dependency. |
better-duck-diesel Features
Thebetter-duck-diesel crate is the Diesel 2.3 backend. Its feature flags are a smaller set — they mainly control whether optional chrono and decimal support flows through from better-duck-core, and whether r2d2 pooling is exposed via Diesel’s own ConnectionManager.
| Feature | Default | Description |
|---|---|---|
decimal | ✓ | Enable Diesel Numeric ↔ rust_decimal::Decimal mapping. Activates better-duck-core/decimal and the rust_decimal dependency. |
chrono | — | Enable Diesel FromSql/ToSql impls for DATE, TIME, TIMESTAMP, TIMESTAMPTZ, INTERVAL, TIME_TZ, and TIME_NS. Activates better-duck-core/chrono, diesel/chrono, and the chrono dependency. |
r2d2 | — | r2d2 connection pool support via Diesel’s own diesel::r2d2::ConnectionManager<DuckDbConnection>. Activates diesel/r2d2. |
The
chrono feature is on by default in better-duck-core but off by
default in better-duck-diesel. If you are using better-duck-diesel with
Diesel date/time columns, you must explicitly enable chrono in your
Cargo.toml dependency on better-duck-diesel. The reason for the
asymmetry is that many Diesel users already pull chrono in through Diesel’s
own feature system and want explicit control over which backend enables it.Enabling Features in Cargo.toml
Addbetter-duck-core or better-duck-diesel to your [dependencies] section and list the features you need. Because these crates are currently in pre-release, you must pin the full version string — Cargo’s default version requirement ("0.1") excludes pre-release versions.
Date/Time Without chrono
When thechrono feature is disabled, all temporal DuckValue variants and AppendAble impls use types from better_duck_core::types::date_native instead of chrono types. The native types are lightweight plain structs with no external dependencies:
| DuckDB type | No-chrono Rust type | Fields |
|---|---|---|
DATE | DuckDate | year: i32, month: u8, day: u8 |
TIME | DuckTime | hour: u8, min: u8, sec: u8, micros: u32 |
TIME_NS | DuckTimeNs | hour: u8, min: u8, sec: u8, nanos: u32 |
TIME WITH TIME ZONE | DuckTimeTz | hour, min, sec, micros, offset_secs: i32 |
TIMESTAMP / TIMESTAMPTZ | std::time::SystemTime | |
INTERVAL | std::time::Duration |
chrono and native types. The decision is made at compile time by the presence or absence of the chrono feature.
better-duck-diesel specifically, remember that the chrono feature must be enabled explicitly — see the note in the better-duck-diesel Features section above.