@@ -38,7 +38,7 @@ second is to emit a [`compile_error`] macro invocation.
38
38
39
39
# ## The `proc_macro` crate
40
40
41
- Procedural macro crates almost always will link to the compiler-provided
41
+ Procedural macro crates almost always will link to the compiler-provided
42
42
[`proc_macro` crate ]. The `proc_macro` crate provides types required for
43
43
writing procedural macros and facilities to make it easier.
44
44
@@ -114,7 +114,7 @@ as `make_answer!{}`, `make_answer!();` or `make_answer![];`.
114
114
### Derive mode macros
115
115
116
116
* Derive mode macros* define new modes for the ` derive ` [ attribute] . These macros
117
- define new [ items] given the token stream of a [ struct] , [ enum] , or [ union] .
117
+ define new [ items] given the token stream of a [ struct] , [ enum] , or [ union] .
118
118
They also define [ derive mode helper attributes] .
119
119
120
120
Custom deriver modes are defined by a [ public]   ; [ function] with the
@@ -195,7 +195,7 @@ struct Struct {
195
195
* Attribute macros* define new [ attributes] which can be attached to [ items] .
196
196
197
197
Attribute macros are defined by a [ public]   ; [ function] with the
198
- ` proc_macro_attribute ` [ attribute] that a signature of
198
+ ` proc_macro_attribute ` [ attribute] that a signature of
199
199
` (TokenStream, TokenStream) -> TokenStream ` . The first [ ` TokenStream ` ] is the
200
200
attribute's metaitems, not including the delimiters. If the attribute is written
201
201
without a metaitem, the attribute [ ` TokenStream ` ] is empty. The second
@@ -228,9 +228,9 @@ shown in the comments after the function prefixed with "out:".
228
228
# use proc_macro::TokenStream;
229
229
230
230
#[proc_macro_attribute]
231
- pub fn show_streams(attr: TokenStream, input : TokenStream) -> TokenStream {
231
+ pub fn show_streams(attr: TokenStream, item : TokenStream) -> TokenStream {
232
232
println!("attr: \"{}\"", attr.to_string());
233
- println!("item: \"{}\"', input .to_string());
233
+ println!("item: \"{}\"", item .to_string());
234
234
item
235
235
}
236
236
```
@@ -259,7 +259,7 @@ fn invoke3() {}
259
259
// out: attr: "multiple words"
260
260
// out: item: "fn invoke3() {}"
261
261
262
- // Example:
262
+ // Example:
263
263
#[show_streams { delimiters }]
264
264
fn invoke4() {}
265
265
// out: "delimiters"
@@ -292,4 +292,4 @@ fn invoke4() {}
292
292
[ procedural macro tutorial ] : ../book/2018-edition/appendix-04-macros.html#procedural-macros-for-custom-derive
293
293
[ public ] : visibility-and-privacy.html
294
294
[ struct ] : items/structs.html
295
- [ unions ] : items/unions.html
295
+ [ union ] : items/unions.html
0 commit comments