| Crates.io | cargo-derive-doc |
| lib.rs | cargo-derive-doc |
| version | 0.0.1-pre.1 |
| created_at | 2025-07-05 20:59:15.910593+00 |
| updated_at | 2025-07-05 20:59:15.910593+00 |
| description | Automatically document macro expansions by adding inline comments showing added impls and items |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1739465 |
| size | 36,537 |
cargo-derive-doc analyzes macro expansions and documents what impls and items the macro expands to
// <generated by cargo-derive-doc>
// Macro expansions:
// pub enum MediaError
// impl core::error::Error for MediaError
// impl core::fmt::Display for MediaError
// impl From<DownloadError> for MediaError
// impl From<BookParsingError> for MediaError
// </generated by cargo-derive-doc>
error_set! {
MediaError = DownloadError || BookParsingError;
// ...
}
supports #[derive()] attributes and function-like macros that generate significant code.
minimally tested, seems to work. still at the basic proof of concept stage, likely buggy. don't be too surprised if it makes incorrect edits you have to roll back.
TODO: add to this repo's nix flake
# install
cargo install --git https://github.com/LunNova/x.git --bin cargo-derive-doc
# document all macro invocations in your workspace
cargo derive-doc --all-targets
# document only examples/
cargo derive-doc --examples --dir-filter examples/
# see what would change without writing
cargo derive-doc --dry-run --examples
runs as a rustc wrapper to capture macro expansions, then diffs original vs expanded code to identify what each macro generates.
#[derive(Debug, Clone)])error_set!, pattern_wishcast!, etc.)Debug, Clone, Copy impls)rustc -Zunpretty=expanded to get fully expanded source-Zunpretty=expanded)see examples/ for demo files showing the tool in action:
error_set_test.rs - function-like macro documentationobvious_doesnt_doc.rs - shows filtering of basic derives