File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Derive
2
2
3
+ r[ attributes.derive]
4
+
5
+
6
+ r[ attributes.derived.general]
3
7
The * ` derive ` attribute* allows new [ items] to be automatically generated for
4
- data structures. It uses the [ _ MetaListPaths_ ] syntax to specify a list of
8
+ data structures.
9
+
10
+ r[ attributes.derive.syntax]
11
+ It uses the [ _ MetaListPaths_ ] syntax to specify a list of
5
12
traits to implement or paths to [ derive macros] to process.
6
13
7
14
For example, the following will create an [ ` impl ` item] for the
@@ -27,10 +34,12 @@ impl<T: PartialEq> PartialEq for Foo<T> {
27
34
}
28
35
```
29
36
37
+ r[ attributes.derive.proc-macro]
30
38
You can implement ` derive ` for your own traits through [ procedural macros] .
31
39
32
40
## The ` automatically_derived ` attribute
33
41
42
+ r[ attributes.derive.automatically_derived]
34
43
The * ` automatically_derived ` attribute* is automatically added to
35
44
[ implementations] created by the ` derive ` attribute for built-in traits. It
36
45
has no direct effect, but it may be used by tools and diagnostic lints to
You can’t perform that action at this time.
0 commit comments