@@ -639,6 +639,17 @@ impl DynTraitType {
639639 pub fn type_bound_list ( & self ) -> Option < TypeBoundList > { support:: child ( & self . syntax ) }
640640}
641641#[ 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 ) ]
642653pub struct TupleExpr {
643654 pub ( crate ) syntax : SyntaxNode ,
644655}
@@ -1168,17 +1179,6 @@ impl MacroStmts {
11681179 pub fn expr ( & self ) -> Option < Expr > { support:: child ( & self . syntax ) }
11691180}
11701181#[ 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 ) ]
11821182pub struct WherePred {
11831183 pub ( crate ) syntax : SyntaxNode ,
11841184}
@@ -2045,6 +2045,17 @@ impl AstNode for DynTraitType {
20452045 }
20462046 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
20472047}
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+ }
20482059impl AstNode for TupleExpr {
20492060 fn can_cast ( kind : SyntaxKind ) -> bool { kind == TUPLE_EXPR }
20502061 fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -2661,17 +2672,6 @@ impl AstNode for MacroStmts {
26612672 }
26622673 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
26632674}
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- }
26752675impl AstNode for WherePred {
26762676 fn can_cast ( kind : SyntaxKind ) -> bool { kind == WHERE_PRED }
26772677 fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -3746,6 +3746,11 @@ impl std::fmt::Display for DynTraitType {
37463746 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
37473747 }
37483748}
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+ }
37493754impl std:: fmt:: Display for TupleExpr {
37503755 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
37513756 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
@@ -4026,11 +4031,6 @@ impl std::fmt::Display for MacroStmts {
40264031 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
40274032 }
40284033}
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- }
40344034impl std:: fmt:: Display for WherePred {
40354035 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
40364036 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
0 commit comments