@@ -1993,13 +1993,15 @@ pub struct TypeBound {
19931993 pub ( crate ) syntax : SyntaxNode ,
19941994}
19951995impl TypeBound {
1996- #[ inline]
1997- pub fn generic_param_list ( & self ) -> Option < GenericParamList > { support:: child ( & self . syntax ) }
19981996 #[ inline]
19991997 pub fn lifetime ( & self ) -> Option < Lifetime > { support:: child ( & self . syntax ) }
20001998 #[ inline]
20011999 pub fn ty ( & self ) -> Option < Type > { support:: child ( & self . syntax ) }
20022000 #[ inline]
2001+ pub fn use_bound_generic_args ( & self ) -> Option < UseBoundGenericArgs > {
2002+ support:: child ( & self . syntax )
2003+ }
2004+ #[ inline]
20032005 pub fn question_mark_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ ?] ) }
20042006 #[ inline]
20052007 pub fn async_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ async ] ) }
@@ -2076,6 +2078,21 @@ impl Use {
20762078 pub fn use_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ use ] ) }
20772079}
20782080
2081+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
2082+ pub struct UseBoundGenericArgs {
2083+ pub ( crate ) syntax : SyntaxNode ,
2084+ }
2085+ impl UseBoundGenericArgs {
2086+ #[ inline]
2087+ pub fn use_bound_generic_args ( & self ) -> AstChildren < UseBoundGenericArg > {
2088+ support:: children ( & self . syntax )
2089+ }
2090+ #[ inline]
2091+ pub fn l_angle_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ <] ) }
2092+ #[ inline]
2093+ pub fn r_angle_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ >] ) }
2094+ }
2095+
20792096#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
20802097pub struct UseTree {
20812098 pub ( crate ) syntax : SyntaxNode ,
@@ -2402,6 +2419,12 @@ pub enum Type {
24022419 TupleType ( TupleType ) ,
24032420}
24042421
2422+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
2423+ pub enum UseBoundGenericArg {
2424+ Lifetime ( Lifetime ) ,
2425+ NameRef ( NameRef ) ,
2426+ }
2427+
24052428#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
24062429pub struct AnyHasArgList {
24072430 pub ( crate ) syntax : SyntaxNode ,
@@ -4435,6 +4458,20 @@ impl AstNode for Use {
44354458 #[ inline]
44364459 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
44374460}
4461+ impl AstNode for UseBoundGenericArgs {
4462+ #[ inline]
4463+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == USE_BOUND_GENERIC_ARGS }
4464+ #[ inline]
4465+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
4466+ if Self :: can_cast ( syntax. kind ( ) ) {
4467+ Some ( Self { syntax } )
4468+ } else {
4469+ None
4470+ }
4471+ }
4472+ #[ inline]
4473+ fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
4474+ }
44384475impl AstNode for UseTree {
44394476 #[ inline]
44404477 fn can_cast ( kind : SyntaxKind ) -> bool { kind == USE_TREE }
@@ -5560,6 +5597,34 @@ impl AstNode for Type {
55605597 }
55615598 }
55625599}
5600+ impl From < Lifetime > for UseBoundGenericArg {
5601+ #[ inline]
5602+ fn from ( node : Lifetime ) -> UseBoundGenericArg { UseBoundGenericArg :: Lifetime ( node) }
5603+ }
5604+ impl From < NameRef > for UseBoundGenericArg {
5605+ #[ inline]
5606+ fn from ( node : NameRef ) -> UseBoundGenericArg { UseBoundGenericArg :: NameRef ( node) }
5607+ }
5608+ impl AstNode for UseBoundGenericArg {
5609+ #[ inline]
5610+ fn can_cast ( kind : SyntaxKind ) -> bool { matches ! ( kind, LIFETIME | NAME_REF ) }
5611+ #[ inline]
5612+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
5613+ let res = match syntax. kind ( ) {
5614+ LIFETIME => UseBoundGenericArg :: Lifetime ( Lifetime { syntax } ) ,
5615+ NAME_REF => UseBoundGenericArg :: NameRef ( NameRef { syntax } ) ,
5616+ _ => return None ,
5617+ } ;
5618+ Some ( res)
5619+ }
5620+ #[ inline]
5621+ fn syntax ( & self ) -> & SyntaxNode {
5622+ match self {
5623+ UseBoundGenericArg :: Lifetime ( it) => & it. syntax ,
5624+ UseBoundGenericArg :: NameRef ( it) => & it. syntax ,
5625+ }
5626+ }
5627+ }
55635628impl AnyHasArgList {
55645629 #[ inline]
55655630 pub fn new < T : ast:: HasArgList > ( node : T ) -> AnyHasArgList {
@@ -6570,6 +6635,11 @@ impl std::fmt::Display for Type {
65706635 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
65716636 }
65726637}
6638+ impl std:: fmt:: Display for UseBoundGenericArg {
6639+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
6640+ std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
6641+ }
6642+ }
65736643impl std:: fmt:: Display for Abi {
65746644 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
65756645 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
@@ -7275,6 +7345,11 @@ impl std::fmt::Display for Use {
72757345 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
72767346 }
72777347}
7348+ impl std:: fmt:: Display for UseBoundGenericArgs {
7349+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
7350+ std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
7351+ }
7352+ }
72787353impl std:: fmt:: Display for UseTree {
72797354 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
72807355 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
0 commit comments