Skip to content

Commit 2a490b7

Browse files
committed
Add runtime_detection feature
Runtime CPU detection currently requires `std`, so by unconditionally enabling it, we further block the possibility of adding `no_std` support. To ensure the default performance for users is unaffected, `runtime_detection` is added to the set of default features. According to the [Cargo Book](https://doc.rust-lang.org/cargo/reference/semver.html#cargo-change-dep-feature), this can be considered a minor change.
1 parent c8be635 commit 2a490b7

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Cargo.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ exclude = [".*"]
2121
[dependencies]
2222
libz-sys = { version = "1.1.20", optional = true, default-features = false }
2323
libz-ng-sys = { version = "1.1.16", optional = true }
24-
# this matches the default features, but we don't want to depend on the default features staying the same
25-
zlib-rs = { version = "0.6.0", optional = true, default-features = false, features = ["std", "rust-allocator"] }
24+
zlib-rs = { version = "0.6.0", optional = true, default-features = false, features = ["rust-allocator"] }
2625
## This implementation uses only safe Rust code and doesn't require a C compiler.
2726
## It provides good performance for most use cases while being completely portable.
2827
miniz_oxide = { version = "0.9.0", optional = true, features = ["simd"] }
29-
crc32fast = { version = "1.2.0", optional = true }
28+
crc32fast = { version = "1.2.0", default-features = false, optional = true }
3029
document-features = { version = "0.2", optional = true }
3130

3231
[dev-dependencies]
@@ -37,7 +36,10 @@ quickcheck = { version = "1.0", default-features = false }
3736
[features]
3837
## The default backend using pure Rust implementation via miniz_oxide.
3938
## This provides a safe, portable compression implementation without requiring a C compiler.
40-
default = ["rust_backend"]
39+
default = ["rust_backend", "runtime_detection"]
40+
41+
## Allows runtime feature detection on supported CPU architectures.
42+
runtime_detection = ["zlib-rs?/std", "crc32fast?/std"]
4143

4244
#! ### User-Facing Backend Features
4345
#! Choose one of these features to select the compression backend.

0 commit comments

Comments
 (0)