#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ExportFormat {
Csv,
Jsonl,
Html,
Prometheus,
JUnit,
}
impl ExportFormat {
pub fn parse(s: &str) -> Option<Self> {
s.parse().ok()
}
}
impl std::str::FromStr for ExportFormat {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"csv" => Ok(ExportFormat::Csv),
"jsonl" => Ok(ExportFormat::Jsonl),
"html" => Ok(ExportFormat::Html),
"prometheus" | "prom" => Ok(ExportFormat::Prometheus),
"junit" | "xml" => Ok(ExportFormat::JUnit),
_ => Err(()),
}
}
}