@@ -1007,12 +1007,12 @@ impl Default for GridAutoFlow {
1007
1007
}
1008
1008
}
1009
1009
1010
- #[ derive( Copy , Clone , PartialEq , Debug , Reflect ) ]
1011
- #[ reflect_value ( PartialEq ) ]
1010
+ #[ derive( Default , Copy , Clone , PartialEq , Debug , Reflect ) ]
1011
+ #[ reflect ( Default , PartialEq ) ]
1012
1012
#[ cfg_attr(
1013
1013
feature = "serialize" ,
1014
1014
derive( serde:: Serialize , serde:: Deserialize ) ,
1015
- reflect_value ( Serialize , Deserialize )
1015
+ reflect ( Serialize , Deserialize )
1016
1016
) ]
1017
1017
pub enum MinTrackSizingFunction {
1018
1018
/// Track minimum size should be a fixed pixel value
@@ -1024,6 +1024,7 @@ pub enum MinTrackSizingFunction {
1024
1024
/// Track minimum size should be content sized under a max-content constraint
1025
1025
MaxContent ,
1026
1026
/// Track minimum size should be automatically sized
1027
+ #[ default]
1027
1028
Auto ,
1028
1029
/// Track minimum size should be a percent of the viewport's smaller dimension.
1029
1030
VMin ( f32 ) ,
@@ -1035,12 +1036,12 @@ pub enum MinTrackSizingFunction {
1035
1036
Vw ( f32 ) ,
1036
1037
}
1037
1038
1038
- #[ derive( Copy , Clone , PartialEq , Debug , Reflect ) ]
1039
- #[ reflect_value ( PartialEq ) ]
1039
+ #[ derive( Default , Copy , Clone , PartialEq , Debug , Reflect ) ]
1040
+ #[ reflect ( Default , PartialEq ) ]
1040
1041
#[ cfg_attr(
1041
1042
feature = "serialize" ,
1042
1043
derive( serde:: Serialize , serde:: Deserialize ) ,
1043
- reflect_value ( Serialize , Deserialize )
1044
+ reflect ( Serialize , Deserialize )
1044
1045
) ]
1045
1046
pub enum MaxTrackSizingFunction {
1046
1047
/// Track maximum size should be a fixed pixel value
@@ -1056,6 +1057,7 @@ pub enum MaxTrackSizingFunction {
1056
1057
/// Track maximum size should be sized according to the fit-content formula with a percentage limit
1057
1058
FitContentPercent ( f32 ) ,
1058
1059
/// Track maximum size should be automatically sized
1060
+ #[ default]
1059
1061
Auto ,
1060
1062
/// The dimension as a fraction of the total available grid space (`fr` units in CSS)
1061
1063
/// Specified value is the numerator of the fraction. Denominator is the sum of all fractions specified in that grid dimension.
@@ -1234,7 +1236,7 @@ impl Default for GridTrack {
1234
1236
}
1235
1237
1236
1238
#[ derive( Copy , Clone , PartialEq , Debug , Reflect ) ]
1237
- #[ reflect( PartialEq ) ]
1239
+ #[ reflect( Default , PartialEq ) ]
1238
1240
#[ cfg_attr(
1239
1241
feature = "serialize" ,
1240
1242
derive( serde:: Serialize , serde:: Deserialize ) ,
@@ -1257,6 +1259,12 @@ pub enum GridTrackRepetition {
1257
1259
AutoFit ,
1258
1260
}
1259
1261
1262
+ impl Default for GridTrackRepetition {
1263
+ fn default ( ) -> Self {
1264
+ Self :: Count ( 1 )
1265
+ }
1266
+ }
1267
+
1260
1268
impl From < u16 > for GridTrackRepetition {
1261
1269
fn from ( count : u16 ) -> Self {
1262
1270
Self :: Count ( count)
@@ -1289,7 +1297,7 @@ impl From<usize> for GridTrackRepetition {
1289
1297
/// then all tracks (in and outside of the repetition) must be fixed size (px or percent). Integer repetitions are just shorthand for writing out
1290
1298
/// N tracks longhand and are not subject to the same limitations.
1291
1299
#[ derive( Clone , PartialEq , Debug , Reflect ) ]
1292
- #[ reflect( PartialEq ) ]
1300
+ #[ reflect( Default , PartialEq ) ]
1293
1301
#[ cfg_attr(
1294
1302
feature = "serialize" ,
1295
1303
derive( serde:: Serialize , serde:: Deserialize ) ,
@@ -1446,6 +1454,15 @@ impl RepeatedGridTrack {
1446
1454
}
1447
1455
}
1448
1456
1457
+ impl Default for RepeatedGridTrack {
1458
+ fn default ( ) -> Self {
1459
+ Self {
1460
+ repetition : Default :: default ( ) ,
1461
+ tracks : SmallVec :: from_buf ( [ GridTrack :: default ( ) ] ) ,
1462
+ }
1463
+ }
1464
+ }
1465
+
1449
1466
impl From < GridTrack > for RepeatedGridTrack {
1450
1467
fn from ( track : GridTrack ) -> Self {
1451
1468
Self {
@@ -1457,10 +1474,7 @@ impl From<GridTrack> for RepeatedGridTrack {
1457
1474
1458
1475
impl From < GridTrack > for Vec < GridTrack > {
1459
1476
fn from ( track : GridTrack ) -> Self {
1460
- vec ! [ GridTrack {
1461
- min_sizing_function: track. min_sizing_function,
1462
- max_sizing_function: track. max_sizing_function,
1463
- } ]
1477
+ vec ! [ track]
1464
1478
}
1465
1479
}
1466
1480
0 commit comments