Skip to content

Commit

Permalink
Make file format features non-default
Browse files Browse the repository at this point in the history
It seems that most users only use a single file format and many forget
to disable default-features, leading to a uselessly inflated dependency
tree. This way around makes the library a tiny bit harder to get started
with, but I am willing to sacrifice this in order to save the world
some compile time.
  • Loading branch information
LukasKalbertodt committed Oct 18, 2024
1 parent 04cf132 commit 415d92a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Run tests with file formats
run: cargo test --features=toml,yaml,json5
- name: Run tests
run: |
cargo test
cargo test --no-default-features
run: cargo test
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ required-features = ["toml"]


[features]
default = ["toml", "yaml", "json5"]
default = []
yaml = ["serde_yaml"]


Expand Down
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
//!
//! # How to use
//!
//! Add `confique` as dependency to your `Cargo.toml` and remember to enable the
//! crate features for file formats you are interested in. For example:
//! `cargo add confique --features=toml`.
//!
//! ## Defining your configuration with structs
//!
//! First, define some structs that describe all your configuration values. Use
Expand Down Expand Up @@ -154,12 +158,12 @@
//!
//! # Cargo features
//!
//! This crate has a Cargo feature for each supported file format which are all
//! enabled by default to get started easily. If you don't need certain
//! features, remember to disable them to save compile time:
//! This crate has a Cargo feature for each supported file format. These are not
//! enabled by default, so you have to specify which file formats you are
//! interested in.
//!
//! ```toml
//! confique = { version = "...", default-features = false, features = ["toml"] }
//! confique = { version = "...", features = ["toml"] }
//! ```
//!
//! All crate features:
Expand Down

0 comments on commit 415d92a

Please sign in to comment.