rustils::parse::float
pub fn bool_to_f32_res(a: bool) -> ParseResultF32
Parse bool to f32
bool
f32
If a is false then returns Ok(0.0). If a is true then returns Ok(1.0).
a
false
Ok(0.0)
true
Ok(1.0)
use rustils::parse::float::bool_to_f32_res; assert_eq!(bool_to_f32_res(true), Ok(1.0_f32)); assert_eq!(bool_to_f32_res(false), Ok(0.0_f32));