1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
4#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
5pub enum Phase {
6 Compile,
7 Plan,
8 FitCv,
9 Select,
10 Refit,
11 Predict,
12 Explain,
13}
14
15impl Phase {
16 pub fn is_training(self) -> bool {
17 matches!(self, Self::FitCv | Self::Refit)
18 }
19
20 pub fn as_str(self) -> &'static str {
23 match self {
24 Self::Compile => "COMPILE",
25 Self::Plan => "PLAN",
26 Self::FitCv => "FIT_CV",
27 Self::Select => "SELECT",
28 Self::Refit => "REFIT",
29 Self::Predict => "PREDICT",
30 Self::Explain => "EXPLAIN",
31 }
32 }
33}