Skip to content

Commit 0dabc89

Browse files
authored
docs(features): improve feature flags docs (#35)
1 parent c9689a2 commit 0dabc89

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

Cargo.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,28 @@ rust-version = "1.85"
2525
[features]
2626
default = ["std"]
2727

28-
## enables std
28+
## Enables usage of standard library.
2929
std = ["thiserror/std", "portable-atomic?/std"]
30-
## use portable-atomic to polyfill CAS atomics on targets that do not have them
30+
31+
## Enables fallback implementations of atomic types on targets without native support.
32+
## Requires adding `portable-atomic` crate as a dependency and setting proper `portable-atomic` feature flags by the
33+
## user based on target platform.
34+
## See [`portable-atomic` crate documentation] for more information.
35+
##
36+
## [`portable-atomic` crate documentation]: https://docs.rs/portable-atomic/latest/portable_atomic
3137
portable-atomic = ["dep:portable-atomic", "dep:portable-atomic-util"]
3238

39+
document-features = ["dep:document-features"]
40+
3341
[dependencies]
3442
hashbrown = "0.16"
3543
portable-atomic = { version = "1.11", default-features = false, features = ["require-cas"], optional = true }
3644
portable-atomic-util = { version = "0.2.4", features = ["alloc"], optional = true }
3745
thiserror = { version = "2.0", default-features = false }
46+
document-features = { version = "0.2", optional = true }
47+
48+
[package.metadata.docs.rs]
49+
all-features = true
3850

3951
[dev-dependencies]
4052
rstest = "0.26"

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@
232232
//! not have any inherent knowledge of user interfaces, directions or boxes. Thus for use in a user
233233
//! interface this crate should ideally be wrapped by a higher level API, which is outside the scope
234234
//! of this crate.
235-
235+
#![cfg_attr(feature = "document-features", doc = "\n## Features")]
236+
#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
236237
#![no_std]
237238
extern crate alloc;
238239

0 commit comments

Comments
 (0)