aboutsummaryrefslogtreecommitdiff
path: root/src/generics.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2018-01-07 22:40:02 -0800
committerDavid Tolnay <dtolnay@gmail.com>2018-01-07 22:40:02 -0800
commit36454bbe226630ee622397767a70bf1bad05c8c7 (patch)
tree9c1338b0f2dd9446110595fd0b2dad81703d9410 /src/generics.rs
parent4cf7db8185d0805be5ffc414397bc546b3ce4b2d (diff)
downloadsyn-36454bbe226630ee622397767a70bf1bad05c8c7.tar.gz
Add Synom for GenericParam
Diffstat (limited to 'src/generics.rs')
-rw-r--r--src/generics.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/generics.rs b/src/generics.rs
index bb61e6c5..737a8014 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -327,6 +327,20 @@ pub mod parsing {
}
}
+ impl Synom for GenericParam {
+ named!(parse -> Self, alt!(
+ syn!(TypeParam) => { GenericParam::Type }
+ |
+ syn!(LifetimeDef) => { GenericParam::Lifetime }
+ |
+ syn!(ConstParam) => { GenericParam::Const }
+ ));
+
+ fn description() -> Option<&'static str> {
+ Some("generic parameter")
+ }
+ }
+
impl Synom for LifetimeDef {
named!(parse -> Self, do_parse!(
attrs: many0!(Attribute::parse_outer) >>