(
value: Option<String>,
field: &str,
parse: impl FnOnce(&str) -> std::result::Result<T, E>,
)
| 828 | } |
| 829 | |
| 830 | fn parse_optional_number<T, E>( |
| 831 | value: Option<String>, |
| 832 | field: &str, |
| 833 | parse: impl FnOnce(&str) -> std::result::Result<T, E>, |
| 834 | ) -> tracedecay::errors::Result<Option<Option<T>>> |
| 835 | where |
| 836 | E: std::fmt::Display, |
| 837 | { |
| 838 | let Some(value) = value else { |
| 839 | return Ok(None); |
| 840 | }; |
| 841 | if string_clears_optional(&value) { |
| 842 | return Ok(Some(None)); |
| 843 | } |
| 844 | parse(&value) |
| 845 | .map(Some) |
| 846 | .map(Some) |
| 847 | .map_err(|err| tracedecay::errors::TraceDecayError::Config { |
| 848 | message: format!("invalid automation config value for {field}: {err}"), |
| 849 | }) |
| 850 | } |
| 851 | |
| 852 | fn print_automation_config( |
| 853 | global: &tracedecay::automation::config::AutomationConfig, |
no test coverage detected