File tree 1 file changed +13
-11
lines changed
1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -1101,28 +1101,30 @@ impl Field {
1101
1101
// ===== impl Fields =====
1102
1102
1103
1103
impl Fields {
1104
- fn named < T > ( & mut self , name : & str , ty : T ) -> & mut Self
1105
- where T : Into < Type > ,
1104
+ fn push_named ( & mut self , field : Field ) -> & mut Self
1106
1105
{
1107
1106
match * self {
1108
1107
Fields :: Empty => {
1109
- * self = Fields :: Named ( vec ! [ Field {
1110
- name: name. to_string( ) ,
1111
- ty: ty. into( ) ,
1112
- } ] ) ;
1108
+ * self = Fields :: Named ( vec ! [ field] ) ;
1113
1109
}
1114
1110
Fields :: Named ( ref mut fields) => {
1115
- fields. push ( Field {
1116
- name : name. to_string ( ) ,
1117
- ty : ty. into ( ) ,
1118
- } ) ;
1111
+ fields. push ( field) ;
1119
1112
}
1120
1113
_ => panic ! ( "field list is named" ) ,
1121
- }
1114
+ } ;
1122
1115
1123
1116
self
1124
1117
}
1125
1118
1119
+ fn named < T > ( & mut self , name : & str , ty : T ) -> & mut Self
1120
+ where T : Into < Type > ,
1121
+ {
1122
+ self . push_named ( Field {
1123
+ name : name. to_string ( ) ,
1124
+ ty : ty. into ( ) ,
1125
+ } )
1126
+ }
1127
+
1126
1128
fn tuple < T > ( & mut self , ty : T ) -> & mut Self
1127
1129
where T : Into < Type > ,
1128
1130
{
You can’t perform that action at this time.
0 commit comments