Skip to content

Commit b90eb9b

Browse files
committed
feat: in-manifest and in-lib documentation of features (#329)
1 parent 5c573bf commit b90eb9b

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

Cargo.lock

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

cargo-features.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,7 @@ All feature toggles are additive.
138138

139139
### git-packetline
140140

141-
By default, all IO related capabilities will be missing unless one of the following is chosen.
142-
143-
* _mutually exclusive_
144-
- Specifying both causes a compile error, preventing the use of `--all-features`.
145-
* **blocking-io**
146-
* If set, all IO will become blocking. The same types will be used preventing side-by-side usage of blocking and non-blocking IO
147-
* **async-io**
148-
* Implement IO traits from `futures-io`
149-
141+
Documented in [its documentation](https://docs.rs/git-packetline).
150142

151143
### git-transport
152144

git-packetline/Cargo.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,20 @@ include = ["src/**/*", "CHANGELOG.md"]
1212
doctest = false
1313

1414
[features]
15+
#! By default, all IO related capabilities will be missing unless one of the following is chosen.
1516
default = []
17+
18+
#! ### _Mutually exclusive_
19+
#! Specifying both causes a compile error, preventing the use of `--all-features`.
20+
21+
## If set, all IO will become blocking. The same types will be used preventing side-by-side usage of blocking and non-blocking IO.
22+
blocking-io = []
23+
## Implement IO traits from `futures-io`.
24+
async-io = ["futures-io", "futures-lite", "pin-project-lite"]
25+
26+
#! ### Other
1627
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
1728
serde1 = ["serde", "bstr/serde1"]
18-
async-io = ["futures-io", "futures-lite", "pin-project-lite"]
19-
blocking-io = []
2029

2130
[[test]]
2231
name = "async-packetline"
@@ -41,8 +50,13 @@ futures-io = { version = "0.3.16", optional = true }
4150
futures-lite = { version = "1.12.0", optional = true }
4251
pin-project-lite = { version = "0.2.6", optional = true }
4352

53+
document-features = { version = "0.1", optional = true }
54+
4455
[dev-dependencies]
4556
git-odb = { path = "../git-odb" }
4657
git-hash = { path = "../git-hash" }
4758
async-std = { version = "1.9.0", features = ["attributes"] }
4859
maybe-async = "0.2.6"
60+
61+
[package.metadata.docs.rs]
62+
features = ["document-features"]

git-packetline/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
//! Read and write the git packet line wire format without copying it.
22
//!
33
//! For reading the packet line format use the [`StreamingPeekableIter`], and for writing the [`Writer`].
4+
//! ## Feature Flags
5+
#![cfg_attr(
6+
feature = "document-features",
7+
cfg_attr(doc, doc = ::document_features::document_features!())
8+
)]
49
#![deny(unsafe_code, rust_2018_idioms, missing_docs)]
510

611
const U16_HEX_BYTES: usize = 4;

0 commit comments

Comments
 (0)