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
24use proc_macro::TokenStream;
25
26mod macro_impl;
27
28/// Embed changelogs from `CHANGELOG.md`
29#[proc_macro_attribute]
30pub fn changelog(attr: TokenStream, item: TokenStream) -> TokenStream {
31 match macro_impl::changelog(attr.into(), item.into()) {
32 Ok(tokens) => tokens.into(),
33 Err(err) => err.into_compile_error().into(),
34 }
35}