@@ -639,6 +639,17 @@ impl DynTraitType {
639
639
pub fn type_bound_list ( & self ) -> Option < TypeBoundList > { support:: child ( & self . syntax ) }
640
640
}
641
641
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
642
+ pub struct TypeBound {
643
+ pub ( crate ) syntax : SyntaxNode ,
644
+ }
645
+ impl TypeBound {
646
+ pub fn lifetime_token ( & self ) -> Option < SyntaxToken > {
647
+ support:: token ( & self . syntax , T ! [ lifetime] )
648
+ }
649
+ pub fn question_mark_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ ?] ) }
650
+ pub fn ty ( & self ) -> Option < Type > { support:: child ( & self . syntax ) }
651
+ }
652
+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
642
653
pub struct TupleExpr {
643
654
pub ( crate ) syntax : SyntaxNode ,
644
655
}
@@ -1168,17 +1179,6 @@ impl MacroStmts {
1168
1179
pub fn expr ( & self ) -> Option < Expr > { support:: child ( & self . syntax ) }
1169
1180
}
1170
1181
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1171
- pub struct TypeBound {
1172
- pub ( crate ) syntax : SyntaxNode ,
1173
- }
1174
- impl TypeBound {
1175
- pub fn lifetime_token ( & self ) -> Option < SyntaxToken > {
1176
- support:: token ( & self . syntax , T ! [ lifetime] )
1177
- }
1178
- pub fn const_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ const ] ) }
1179
- pub fn ty ( & self ) -> Option < Type > { support:: child ( & self . syntax ) }
1180
- }
1181
- #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1182
1182
pub struct WherePred {
1183
1183
pub ( crate ) syntax : SyntaxNode ,
1184
1184
}
@@ -2045,6 +2045,17 @@ impl AstNode for DynTraitType {
2045
2045
}
2046
2046
fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
2047
2047
}
2048
+ impl AstNode for TypeBound {
2049
+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == TYPE_BOUND }
2050
+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
2051
+ if Self :: can_cast ( syntax. kind ( ) ) {
2052
+ Some ( Self { syntax } )
2053
+ } else {
2054
+ None
2055
+ }
2056
+ }
2057
+ fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
2058
+ }
2048
2059
impl AstNode for TupleExpr {
2049
2060
fn can_cast ( kind : SyntaxKind ) -> bool { kind == TUPLE_EXPR }
2050
2061
fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -2661,17 +2672,6 @@ impl AstNode for MacroStmts {
2661
2672
}
2662
2673
fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
2663
2674
}
2664
- impl AstNode for TypeBound {
2665
- fn can_cast ( kind : SyntaxKind ) -> bool { kind == TYPE_BOUND }
2666
- fn cast ( syntax : SyntaxNode ) -> Option < Self > {
2667
- if Self :: can_cast ( syntax. kind ( ) ) {
2668
- Some ( Self { syntax } )
2669
- } else {
2670
- None
2671
- }
2672
- }
2673
- fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
2674
- }
2675
2675
impl AstNode for WherePred {
2676
2676
fn can_cast ( kind : SyntaxKind ) -> bool { kind == WHERE_PRED }
2677
2677
fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -3746,6 +3746,11 @@ impl std::fmt::Display for DynTraitType {
3746
3746
std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
3747
3747
}
3748
3748
}
3749
+ impl std:: fmt:: Display for TypeBound {
3750
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
3751
+ std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
3752
+ }
3753
+ }
3749
3754
impl std:: fmt:: Display for TupleExpr {
3750
3755
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
3751
3756
std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
@@ -4026,11 +4031,6 @@ impl std::fmt::Display for MacroStmts {
4026
4031
std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
4027
4032
}
4028
4033
}
4029
- impl std:: fmt:: Display for TypeBound {
4030
- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
4031
- std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
4032
- }
4033
- }
4034
4034
impl std:: fmt:: Display for WherePred {
4035
4035
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
4036
4036
std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
0 commit comments