feat: make document-features crate optional (#991)

This commit is contained in:
Matias Fontanini 2025-05-19 17:49:01 -07:00 committed by GitHub
parent 922e951723
commit 1719231047
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -21,7 +21,7 @@ path = "src/lib.rs"
all-features = true
[features]
default = ["bracketed-paste", "events", "windows", "derive-more"]
default = ["bracketed-paste", "derive-more", "events", "windows"]
#! ### Default features
## Enables triggering [`Event::Paste`](event::Event::Paste) when pasting text into the terminal.
@ -33,8 +33,14 @@ events = ["dep:mio", "dep:signal-hook", "dep:signal-hook-mio"]
## Enables windows specific crates.
windows = ["dep:winapi", "dep:crossterm_winapi"]
## Enables `is_*` helper functions for event enums.
derive-more = ["dep:derive_more"]
#! ### Optional Features
## Enables documentation for crate features.
document-features = ["dep:document-features"]
## Enables the [EventStream](event::EventStream) struct for async event reading.
event-stream = ["dep:futures-core", "events"]
@ -44,9 +50,6 @@ serde = ["dep:serde", "bitflags/serde"]
## Enables raw file descriptor polling / selecting instead of mio.
use-dev-tty = ["filedescriptor", "rustix/process"]
## Enables `is_*` helper functions for event enums.
derive-more = ["dep:derive_more"]
## Enables interacting with a host clipboard via [`clipboard`](clipboard/index.html)
osc52 = ["dep:base64"]
@ -54,7 +57,7 @@ osc52 = ["dep:base64"]
base64 = { version = "0.22", optional = true }
bitflags = { version = "2.9" }
derive_more = { version = "2.0.0", features = ["is_variant"], optional = true }
document-features = "0.2.11"
document-features = { version = "0.2.11", optional = true }
futures-core = { version = "0.3", optional = true, default-features = false }
parking_lot = "0.12"
serde = { version = "1.0", features = ["derive"], optional = true }

View File

@ -226,8 +226,9 @@
//! Ok(())
//! }
//!```
//! ## Feature Flags
#![doc = document_features::document_features!()]
//!
#![cfg_attr(feature = "document-features", doc = "## Feature Flags")]
#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
//!
//! [write]: https://doc.rust-lang.org/std/io/trait.Write.html
//! [stdout]: https://doc.rust-lang.org/std/io/fn.stdout.html