scuffle_changelog/
lib.rs

1//! A crate for embedding change logs into rust docs.
2//!
3//! ## Usage
4//!
5//! ```rust,ignore
6//! /// Changelogs generated by [scuffle_changelog]
7//! #[cfg(feature = "docs")]
8//! #[scuffle_changelog::changelog]
9//! pub mod changelog {}
10//! ```
11//!
12//! ## License
13//!
14//! This project is licensed under the MIT or Apache-2.0 license.
15//! You can choose between one of them if you use this work.
16//!
17//! `SPDX-License-Identifier: MIT OR Apache-2.0`
18#![cfg_attr(all(coverage_nightly, test), feature(coverage_attribute))]
19#![cfg_attr(docsrs, feature(doc_auto_cfg))]
20#![deny(missing_docs)]
21#![deny(unsafe_code)]
22#![deny(unreachable_pub)]
23#![deny(clippy::mod_module_files)]
24
25use proc_macro::TokenStream;
26
27mod macro_impl;
28
29/// Embed changelogs from `CHANGELOG.md`
30#[proc_macro_attribute]
31pub fn changelog(attr: TokenStream, item: TokenStream) -> TokenStream {
32    match macro_impl::changelog(attr.into(), item.into()) {
33        Ok(tokens) => tokens.into(),
34        Err(err) => err.into_compile_error().into(),
35    }
36}