Skip to content

Commit

Permalink
feat: in-manifest and in-lib feature documentation (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Feb 6, 2022
1 parent 2001b94 commit 0826cc9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions cargo-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,7 @@ The _client_ portion of transport can be blocking or async. If none is selected,

### git-protocol

The _client_ portion of the protocol uses `git-transport` to communicate to a server. For it to be available, one of the following features must
be selected.

- _mutually exclusive_
- Specifying both causes a compile error, preventing the use of `--all-features`.
* **blocking-client**
* If set, blocking command implementations are available and will use the blocking version of the `git-transport` crate.
* **async-client**
* As above, but provides async implementations instead.
Documented in [its documentation](https://docs.rs/git-protocol).

### git-object

Expand Down
19 changes: 16 additions & 3 deletions git-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ include = ["src/**/*", "CHANGELOG.md", "!**/tests/**/*"]
doctest = false

[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
serde1 = ["serde", "bstr/serde1", "git-transport/serde1", "git-hash/serde1"]

#! ### _Mutually exclusive client _
#! The _client_ portion of the protocol uses `git-transport` to communicate to a server. For it to be available, one of the following features must
#! be selected.
#!
#! Specifying both causes a compile error, preventing the use of `--all-features`.

## If set, blocking command implementations are available and will use the blocking version of the `git-transport` crate.
blocking-client = ["git-transport/blocking-client", "maybe-async/is_sync"]
## As above, but provides async implementations instead.
async-client = ["git-transport/async-client", "async-trait", "futures-io", "futures-lite"]

#! ### Other
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
serde1 = ["serde", "bstr/serde1", "git-transport/serde1", "git-hash/serde1"]

[[test]]
name = "blocking-client-protocol"
path = "tests/blocking-protocol.rs"
Expand Down Expand Up @@ -44,10 +55,12 @@ futures-io = { version = "0.3.16", optional = true }
futures-lite = { version = "1.12.0", optional = true }
maybe-async = "0.2.6"

document-features = { version = "0.1.0", optional = true }

[dev-dependencies]
async-std = { version = "1.9.0", features = ["attributes"] }
git-packetline = { path = "../git-packetline" ,version = "^0.12.3" }
git-testtools = { path = "../tests/tools" }

[package.metadata.docs.rs]
features = ["blocking-client"]
features = ["blocking-client", "document-features"]
5 changes: 5 additions & 0 deletions git-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
//!
//! This implementation hides the transport layer, statefulness and the protocol version to the [fetch delegate][fetch::Delegate],
//! the actual client implementation.
//! ## Feature Flags
#![cfg_attr(
feature = "document-features",
cfg_attr(doc, doc = ::document_features::document_features!())
)]
#![deny(unsafe_code)]
#![deny(rust_2018_idioms, missing_docs)]

Expand Down

0 comments on commit 0826cc9

Please sign in to comment.