Skip to content

Commit e534ea1

Browse files
committed
Add documentation for all the variants in ReflectiveInputType
1 parent 78e598e commit e534ea1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

proc_macro_example_derive/src/reflective.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ use crate::prelude::*;
3131
/// }// ^------ This enum will capture the `Union` variant since it's a `union`.
3232
/// ```
3333
pub enum ReflectiveInputType<'a> {
34+
/// Captures a `struct`'s fields. This isn't [`FieldsNamed`] due to the existence tuple structs.
3435
Fields(&'a Fields),
35-
// `syn::punctuated::Punctuated` is also a type that saves boilerplate. For a declarative macro
36-
// equivalent it'd be parsing: `$($x:Variant),+ $(,)?` (if declarative macros had `Variant` as
37-
// a fragment specifier that is). This extra comma token makes it so there could or could not
38-
// be one more type after the last comma token parsed. We take these things for granted as
39-
// users but this has to be addressed while we're parsing Rust code.
36+
/// [`syn::punctuated::Punctuated`] is also a type that saves boilerplate. For a declarative macro
37+
/// equivalent it'd be parsing: `$($x:Variant),+ $(,)?` (if declarative macros had `Variant` as
38+
/// a fragment specifier that is). This extra comma token makes it so there could or could not
39+
/// be one more type after the last comma token parsed. We take these things for granted as
40+
/// users but this has to be addressed while we're parsing Rust code.
4041
Variants(&'a Punctuated<Variant, Token![,]>),
42+
/// Unlike `struct`'s, unions are forced to have named fields, thus using [`FieldsNamed`].
4143
UnionFields(&'a FieldsNamed),
4244
}
4345

0 commit comments

Comments
 (0)