diff options
author | Aleksey Kladov <[email protected]> | 2018-08-22 14:46:42 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-22 14:46:42 +0100 |
commit | 8e3bec11ebd1fce78701670cf9189b5a9d0d68f8 (patch) | |
tree | 16066a9bed666d0176bfa656a310fe9a264af53c /crates/libsyntax2/src/ast/mod.rs | |
parent | 55896aedb16e9eae6309bf129d04a75e6d26530d (diff) |
TypeParamList Owner
Diffstat (limited to 'crates/libsyntax2/src/ast/mod.rs')
-rw-r--r-- | crates/libsyntax2/src/ast/mod.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs index 5b9a07db4..1784b871e 100644 --- a/crates/libsyntax2/src/ast/mod.rs +++ b/crates/libsyntax2/src/ast/mod.rs | |||
@@ -24,6 +24,22 @@ pub trait NameOwner<'a>: AstNode<'a> { | |||
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
27 | pub trait TypeParamsOwner<'a>: AstNode<'a> { | ||
28 | fn type_param_list(self) -> Option<TypeParamList<'a>> { | ||
29 | self.syntax() | ||
30 | .children() | ||
31 | .filter_map(TypeParamList::cast) | ||
32 | .next() | ||
33 | } | ||
34 | |||
35 | fn where_clause(self) -> Option<WhereClause<'a>> { | ||
36 | self.syntax() | ||
37 | .children() | ||
38 | .filter_map(WhereClause::cast) | ||
39 | .next() | ||
40 | } | ||
41 | } | ||
42 | |||
27 | pub trait AttrsOwner<'a>: AstNode<'a> { | 43 | pub trait AttrsOwner<'a>: AstNode<'a> { |
28 | fn attrs(&self) -> Box<Iterator<Item=Attr<'a>> + 'a> { | 44 | fn attrs(&self) -> Box<Iterator<Item=Attr<'a>> + 'a> { |
29 | let it = self.syntax().children() | 45 | let it = self.syntax().children() |