Crate bool_mappings

Crate bool_mappings 

Source
Expand description

Useful extensions to convert bool to other Rust types.

At the moment there are two extensions:

  • .true_or()
  • .false_or()

§Examples

use bool_mappings::BoolMappings;
 
struct MyError;

// Turn a bool into a Result
fn some_fn() -> Result<(), MyError> {
    true.true_or(MyError)
}

fn some_other_fn() -> Result<(), MyError> {
    true.false_or(MyError)
}

Traits§

BoolMappings
This extension trait adds additional methods to bools