@@ -447,13 +447,13 @@ pub struct ScanByTimeAndId<Selector = ()> {
447447#[ serde( rename_all = "snake_case" ) ]
448448pub enum TimeAndIdSortMode {
449449 /// sort in increasing order of timestamp and ID, i.e., earliest first
450- Ascending ,
450+ TimeAndIdAscending ,
451451 /// sort in increasing order of timestamp and ID, i.e., most recent first
452- Descending ,
452+ TimeAndIdDescending ,
453453}
454454
455455fn default_ts_id_sort_mode ( ) -> TimeAndIdSortMode {
456- TimeAndIdSortMode :: Ascending
456+ TimeAndIdSortMode :: TimeAndIdAscending
457457}
458458
459459impl < T : Clone + Debug + DeserializeOwned + JsonSchema + PartialEq + Serialize >
@@ -462,8 +462,10 @@ impl<T: Clone + Debug + DeserializeOwned + JsonSchema + PartialEq + Serialize>
462462 type MarkerValue = ( DateTime < Utc > , Uuid ) ;
463463 fn direction ( & self ) -> PaginationOrder {
464464 match self . sort_by {
465- TimeAndIdSortMode :: Ascending => PaginationOrder :: Ascending ,
466- TimeAndIdSortMode :: Descending => PaginationOrder :: Descending ,
465+ TimeAndIdSortMode :: TimeAndIdAscending => PaginationOrder :: Ascending ,
466+ TimeAndIdSortMode :: TimeAndIdDescending => {
467+ PaginationOrder :: Descending
468+ }
467469 }
468470 }
469471 fn from_query ( p : & PaginatedByTimeAndId < T > ) -> Result < & Self , HttpError > {
@@ -579,7 +581,7 @@ mod test {
579581 selector : ( ) ,
580582 } ;
581583 let scan_by_time_and_id = ScanByTimeAndId :: < ( ) > {
582- sort_by : TimeAndIdSortMode :: Ascending ,
584+ sort_by : TimeAndIdSortMode :: TimeAndIdAscending ,
583585 selector : ( ) ,
584586 } ;
585587 let id: Uuid = "61a78113-d3c6-4b35-a410-23e9eae64328" . parse ( ) . unwrap ( ) ;
@@ -961,7 +963,7 @@ mod test {
961963 #[ test]
962964 fn test_scan_by_time_and_id ( ) {
963965 let scan = ScanByTimeAndId {
964- sort_by : TimeAndIdSortMode :: Ascending ,
966+ sort_by : TimeAndIdSortMode :: TimeAndIdAscending ,
965967 selector : ( ) ,
966968 } ;
967969
@@ -982,7 +984,7 @@ mod test {
982984 let ( p0, p1) = test_scan_param_common (
983985 & list,
984986 & scan,
985- "sort_by=ascending " ,
987+ "sort_by=time_and_id_ascending " ,
986988 & item0_marker,
987989 & item_last_marker,
988990 & scan,
@@ -1005,13 +1007,13 @@ mod test {
10051007
10061008 // test descending too, why not (it caught a mistake!)
10071009 let scan_desc = ScanByTimeAndId {
1008- sort_by : TimeAndIdSortMode :: Descending ,
1010+ sort_by : TimeAndIdSortMode :: TimeAndIdDescending ,
10091011 selector : ( ) ,
10101012 } ;
10111013 let ( p0, p1) = test_scan_param_common (
10121014 & list,
10131015 & scan_desc,
1014- "sort_by=descending " ,
1016+ "sort_by=time_and_id_descending " ,
10151017 & item0_marker,
10161018 & item_last_marker,
10171019 & scan,
@@ -1039,7 +1041,7 @@ mod test {
10391041
10401042 assert_eq ! (
10411043 error. to_string( ) ,
1042- "unknown variant `nothing`, expected `ascending ` or `descending `"
1044+ "unknown variant `nothing`, expected `time_and_id_ascending ` or `time_and_id_descending `"
10431045 ) ;
10441046 }
10451047}
0 commit comments