1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// =============================================================================
// Copyright (c) 2025 - 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! # Transformer Clone Macro
//!
//! Generates `Clone` implementations for Transformer types.
//!
//! The macro supports Transformer structs with two or three type parameters.
//! It clones each struct's `function` and `metadata` fields using their
//! respective `Clone` implementations. For smart pointers such as `Arc` and
//! `Rc`, cloning the `function` field is a shallow clone.
//!
//! # Parameters
//!
//! * `$struct_name` - Transformer struct identifier
//! * `$t`, `$r` - Type parameter identifiers for a two-parameter Transformer
//! * `$t`, `$u`, `$r` - Type parameter identifiers for a three-parameter
//! Transformer
//!
//! # Examples
//!
//! ```ignore
//! // For two type parameters
//! impl_transformer_clone!(ArcTransformer<T, U>);
//!
//! // For two type parameters with Rc
//! impl_transformer_clone!(RcTransformer<T, U>);
//!
//! // For three type parameters
//! impl_transformer_clone!(ArcBiTransformer<T, U, V>);
//!
//! // For three type parameters with Rc
//! impl_transformer_clone!(RcBiTransformer<T, U, V>);
//! ```
/// Generates a `Clone` implementation for a Transformer type.
///
/// This macro should be used at the top level (outside of any impl block) as
/// it expands to a complete `impl Clone for $struct_name` block. The target
/// struct must have `function` and `metadata` fields that implement `Clone`.
/// Cloning smart pointers such as `Arc` or `Rc` in the `function` field is
/// shallow.
///
/// # Parameters
///
/// * `$struct_name` - Transformer struct identifier
/// * `$t`, `$r` - Type parameter identifiers for a two-parameter Transformer
/// * `$t`, `$u`, `$r` - Type parameter identifiers for a three-parameter
/// Transformer
///
/// # Examples
///
/// ```ignore
/// // For two type parameters with Arc
/// impl_transformer_clone!(ArcTransformer<T, U>);
///
/// // For two type parameters with Rc
/// impl_transformer_clone!(RcTransformer<T, U>);
///
/// // For three type parameters with Arc
/// impl_transformer_clone!(ArcBiTransformer<T, U, V>);
///
/// // For three type parameters with Rc
/// impl_transformer_clone!(RcBiTransformer<T, U, V>);
/// ```
pub use impl_transformer_clone;