(value: &str)
| 911 | } |
| 912 | |
| 913 | fn parse_cost_source(value: &str) -> Result<CostSource, String> { |
| 914 | match value { |
| 915 | "auto" => Ok(CostSource::Auto), |
| 916 | "ccusage" => Ok(CostSource::Ccusage), |
| 917 | "cc" => Ok(CostSource::Cc), |
| 918 | "both" => Ok(CostSource::Both), |
| 919 | _ => Err(format!("Invalid cost source '{value}'")), |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | #[cfg(test)] |
| 924 | mod tests { |