qm_utils_derive/lib.rs
1#![deny(missing_docs)]
2
3//! Procedural macros for utility functions.
4//!
5//! This crate provides procedural macros for generating utility code.
6//!
7//! ## Macros
8//!
9//! - [`cheap_clone`] - Derive macro for cheap clone operations
10//!
11//! ## Usage
12//!
13//! \```ignore
14//! use qm_utils_derive::CheapClone;
15//!
16//! #[derive(CheapClone)]
17//! struct MyStruct {
18//! data: Arc<Data>,
19//! }
20//! \```
21
22use proc_macro::TokenStream;
23
24mod cheap_clone;
25
26/// Derive macro for generating cheap clone implementations.
27///
28/// This macro generates a `cheap_clone` method that clones internal `Arc`
29/// fields without cloning the entire struct. Useful for types that are
30/// cheap to share via `Arc` but expensive to clone directly.
31#[proc_macro_derive(CheapClone)]
32pub fn cheap_clone(item: TokenStream) -> TokenStream {
33 cheap_clone::expand(item)
34}