Skip to content

Commit

Permalink
feat: in-manifest and in-lib documentation of features (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Feb 6, 2022
1 parent 5c573bf commit b90eb9b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 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 @@ -138,15 +138,7 @@ All feature toggles are additive.

### git-packetline

By default, all IO related capabilities will be missing unless one of the following is chosen.

* _mutually exclusive_
- Specifying both causes a compile error, preventing the use of `--all-features`.
* **blocking-io**
* If set, all IO will become blocking. The same types will be used preventing side-by-side usage of blocking and non-blocking IO
* **async-io**
* Implement IO traits from `futures-io`

Documented in [its documentation](https://docs.rs/git-packetline).

### git-transport

Expand Down
18 changes: 16 additions & 2 deletions git-packetline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@ include = ["src/**/*", "CHANGELOG.md"]
doctest = false

[features]
#! By default, all IO related capabilities will be missing unless one of the following is chosen.
default = []

#! ### _Mutually exclusive_
#! Specifying both causes a compile error, preventing the use of `--all-features`.

## If set, all IO will become blocking. The same types will be used preventing side-by-side usage of blocking and non-blocking IO.
blocking-io = []
## Implement IO traits from `futures-io`.
async-io = ["futures-io", "futures-lite", "pin-project-lite"]

#! ### Other
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
serde1 = ["serde", "bstr/serde1"]
async-io = ["futures-io", "futures-lite", "pin-project-lite"]
blocking-io = []

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

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

[dev-dependencies]
git-odb = { path = "../git-odb" }
git-hash = { path = "../git-hash" }
async-std = { version = "1.9.0", features = ["attributes"] }
maybe-async = "0.2.6"

[package.metadata.docs.rs]
features = ["document-features"]
5 changes: 5 additions & 0 deletions git-packetline/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
//! Read and write the git packet line wire format without copying it.
//!
//! For reading the packet line format use the [`StreamingPeekableIter`], and for writing the [`Writer`].
//! ## Feature Flags
#![cfg_attr(
feature = "document-features",
cfg_attr(doc, doc = ::document_features::document_features!())
)]
#![deny(unsafe_code, rust_2018_idioms, missing_docs)]

const U16_HEX_BYTES: usize = 4;
Expand Down

0 comments on commit b90eb9b

Please sign in to comment.