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
//! Derive macros for the [`module`](https://github.com/threadexio/module-rs) crate.
/// Derive the `Merge` trait.
///
/// This macro can be used only on `struct` items.
///
/// Generate a `Merge` implementation for the annotated type. The generated code
/// calls `.merge` and `.merge_ref` on each field.
///
/// # Field attributes
///
/// ## `rename`
///
/// * **Syntax:** `#[merge(rename = "foo")]`
///
/// Rename a field so it appears under a different name in the error context.
///
/// ## `skip`
///
/// * **Syntax:** `#[merge(skip)]`
///
/// Completely skip merging this field. This instructs the macro to not emit
/// code for merging the field. Skipped fields retain the value of `self`.
///
/// ## `with`
///
/// * **Syntax:** `#[merge(with = path::to::custom::merge)]`
///
/// Use `$module::merge` and `$module::merge_ref` to merge this field instead of
/// its own `Merge` implementation.
///
/// This can be used to make external types `Merge` without having to use
/// newtypes.