rustils::parse::usize
pub fn bool_to_usize(a: bool) -> usize
Parse bool to usize
bool
usize
If a is false then returns 0. If a is true then returns 1.
a
false
true
use rustils::parse::usize::bool_to_usize; assert_eq!(bool_to_usize(true), 1_usize); assert_eq!(bool_to_usize(false), 0_usize);