mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-05 21:07:43 +00:00
e94d462652
Signed-off-by: mujunxiang <1948535941@qq.com>
10 lines
386 B
Rust
10 lines
386 B
Rust
use crate::error::{Error, Result};
|
|
|
|
pub fn parse_bool(str: &str) -> Result<bool> {
|
|
match str {
|
|
"1" | "t" | "T" | "true" | "TRUE" | "True" | "on" | "ON" | "On" | "enabled" => Ok(true),
|
|
"0" | "f" | "F" | "false" | "FALSE" | "False" | "off" | "OFF" | "Off" | "disabled" => Ok(false),
|
|
_ => Err(Error::from_string(format!("ParseBool: parsing {}", str))),
|
|
}
|
|
}
|