config_docs/
lib.rs

1//! # Config Docs
2//!
3//! This crate adds a trait with a derive macro to create a documentation for your struct in code.
4//! This is useful for things like configuration objects that should be documented in your app.
5//!
6//!
7//! ## Disclaimer
8//! This project came into place for a small project I'm working on and is in no means perfect. If
9//! you have any suggestions, please consider contributing on [Github](https://github.com/Ceedrich/config_docs)
10//!
11//! ## Usage Example
12//! ```
13//! use config_docs::ConfigDocs;
14//!
15//! #[derive(ConfigDocs)]
16//! struct Config {
17//!     /// Holds the colors for your app
18//!     colors: ColorConfig,
19//!     /// Holds the keybinds for your app
20//!     keybinds: KeybindConfig,
21//! }
22//!
23//! #[derive(ConfigDocs)]
24//! struct ColorConfig {
25//!     /// The foreground color for your app as a hex value
26//!     fg: String,
27//!     /// The background color for your app as a hex value
28//!     bg: String,
29//! }
30//!
31//! #[derive(ConfigDocs)]
32//! struct KeybindConfig {
33//!     /// Show the help inside your app
34//!     help: String,
35//!     /// Quit your app
36//!     quit: String
37//! }
38//!
39//! assert_eq!(Config::config_docs(), &[
40//!     ("colors", "Holds the colors for your app"),
41//!     ("fg", "The foreground color for your app as a hex value"),
42//!     ("bg", "The background color for your app as a hex value"),
43//!     ("keybinds", "Holds the keybinds for your app"),
44//!     ("help", "Show the help inside your app"),
45//!     ("quit", "Quit your app")
46//! ])
47//! ```
48//!
49
50mod config_docs;
51
52pub use config_docs::*;
53pub use config_docs_macros::ConfigDocs;