@@ -805,13 +805,18 @@ pub enum BenchmarkRequestStatus {
805
805
Completed ,
806
806
}
807
807
808
+ const WAITING_FOR_ARTIFACTS_STR : & str = "waiting_for_artifacts" ;
809
+ const ARTIFACTS_READY_STR : & str = "artifacts_ready" ;
810
+ const IN_PROGRESS_STR : & str = "in_progress" ;
811
+ const COMPLETED_STR : & str = "completed" ;
812
+
808
813
impl BenchmarkRequestStatus {
809
814
pub fn as_str ( & self ) -> & str {
810
815
match self {
811
- BenchmarkRequestStatus :: WaitingForArtifacts => "waiting_for_artifacts" ,
812
- BenchmarkRequestStatus :: ArtifactsReady => "artifacts_ready" ,
813
- BenchmarkRequestStatus :: InProgress => "in_progress" ,
814
- BenchmarkRequestStatus :: Completed => "completed" ,
816
+ BenchmarkRequestStatus :: WaitingForArtifacts => WAITING_FOR_ARTIFACTS_STR ,
817
+ BenchmarkRequestStatus :: ArtifactsReady => ARTIFACTS_READY_STR ,
818
+ BenchmarkRequestStatus :: InProgress => IN_PROGRESS_STR ,
819
+ BenchmarkRequestStatus :: Completed { .. } => COMPLETED_STR ,
815
820
}
816
821
}
817
822
}
@@ -831,10 +836,10 @@ impl<'a> tokio_postgres::types::FromSql<'a> for BenchmarkRequestStatus {
831
836
let s: & str = <& str as tokio_postgres:: types:: FromSql >:: from_sql ( ty, raw) ?;
832
837
833
838
match s {
834
- x if x == Self :: WaitingForArtifacts . as_str ( ) => Ok ( Self :: WaitingForArtifacts ) ,
835
- x if x == Self :: ArtifactsReady . as_str ( ) => Ok ( Self :: ArtifactsReady ) ,
836
- x if x == Self :: InProgress . as_str ( ) => Ok ( Self :: InProgress ) ,
837
- x if x == Self :: Completed . as_str ( ) => Ok ( Self :: Completed ) ,
839
+ WAITING_FOR_ARTIFACTS_STR => Ok ( Self :: WaitingForArtifacts ) ,
840
+ ARTIFACTS_READY_STR => Ok ( Self :: ArtifactsReady ) ,
841
+ IN_PROGRESS_STR => Ok ( Self :: InProgress ) ,
842
+ COMPLETED_STR => Ok ( Self :: Completed ) ,
838
843
other => Err ( format ! ( "unknown benchmark_request_status '{other}'" ) . into ( ) ) ,
839
844
}
840
845
}
0 commit comments