curly-injector/src/utils.rs
2025-05-16 01:31:53 +07:00

11 lines
284 B
Rust

use std::env::VarError;
pub trait EnvBoolMapper {
fn map_env_bool(self, default: bool) -> bool;
}
impl EnvBoolMapper for Result<String, VarError> {
fn map_env_bool(self, default: bool) -> bool {
self.map(|val| matches!(val.as_str(), "y")).unwrap_or(default)
}
}