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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//! You probably want the [`aliri_braid`] crate, which
//! has the documentation this crate lacks.
//!
//! [`aliri_braid`]: https://docs.rs/aliri_braid/*/aliri_braid/
extern crate proc_macro;
use ;
use TokenStream;
use parse_macro_input;
/// Constructs a braid
///
/// Any attributes assigned to the the struct will be applied to both the owned
/// and borrowed types, except for doc-comments, with will only be applied to the
/// owned form.
///
/// Available options:
/// * `ref_name = "RefName"`
/// * Sets the name of the borrowed type
/// * `ref_doc = "Alternate doc comment"`
/// * Overrides the default doc comment for the borrowed type
/// * `ref_attr = "#[derive(...)]"`
/// * Provides an attribute to be placed only on the borrowed type
/// * `owned_attr = "#[derive(...)]"`
/// * Provides an attribute to be placed only on the owned type
/// * either `validator [ = "Type" ]` or `normalizer [ = "Type" ]`
/// * Indicates the type is validated or normalized. If not specified, it is assumed that the
/// braid implements the relevant trait itself.
/// * `clone = "impl|omit"` (default: `impl`)
/// * Changes the automatic derivation of a `Clone` implementation on the owned type.
/// * `debug = "impl|owned|omit"` (default `impl`)
/// * Changes how automatic implementations of the `Debug` trait are provided. If `owned`, then
/// the owned type will generate a `Debug` implementation that will just delegate to the
/// borrowed implementation. If `omit`, then no implementations of `Debug` will be provided.
/// * `display = "impl|owned|omit"` (default `impl`)
/// * Changes how automatic implementations of the `Display` trait are provided. If `owned`, then
/// the owned type will generate a `Display` implementation that will just delegate to the
/// borrowed implementation. If `omit`, then no implementations of `Display` will be provided.
/// * `ord = "impl|owned|omit"` (default `impl`)
/// * Changes how automatic implementations of the `PartialOrd` and `Ord` traits are provided. If
/// `owned`, then the owned type will generate implementations that will just delegate to the
/// borrowed implementations. If `omit`, then no implementations will be provided.
/// * `serde = "impl|omit"` (default `omit`)
/// * Adds serialize and deserialize implementations
/// * `no_expose`
/// * Functions that expose the internal field type will not be exposed publicly.
/// * `no_std`
/// * Generates `no_std`-compatible braid (still requires `alloc`)
/// Constructs a ref-only braid
///
/// Available options:
/// * either `validator [ = "Type" ]`
/// * Indicates the type is validated. If not specified, it is assumed that the braid implements
/// the relevant trait itself.
/// * `debug = "impl|omit"` (default `impl`)
/// * Changes how automatic implementations of the `Debug` trait are provided. If `omit`, then no
/// implementations of `Debug` will be provided.
/// * `display = "impl|omit"` (default `impl`)
/// * Changes how automatic implementations of the `Display` trait are provided. If `omit`, then
/// no implementations of `Display` will be provided.
/// * `ord = "impl|omit"` (default `impl`)
/// * Changes how automatic implementations of the `PartialOrd` and `Ord` traits are provided. If
/// `omit`, then no implementations will be provided.
/// * `serde = "impl|omit"` (default `omit`)
/// * Adds serialize and deserialize implementations
/// * `no_std`
/// * Generates a `no_std`-compatible braid that doesn't require `alloc`