use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum CodeType {
Production,
Test,
TestUtility,
Benchmark,
Example,
BuildScript,
}
impl CodeType {
pub fn as_str(&self) -> &'static str {
match self {
Self::Production => "production",
Self::Test => "test",
Self::TestUtility => "test_utility",
Self::Benchmark => "benchmark",
Self::Example => "example",
Self::BuildScript => "build_script",
}
}
pub fn is_production(&self) -> bool {
matches!(self, Self::Production)
}
pub fn is_test_related(&self) -> bool {
matches!(self, Self::Test | Self::TestUtility | Self::Benchmark)
}
}