bool-mappings

Crates.iobool-mappings
lib.rsbool-mappings
version0.1.2
sourcesrc
created_at2023-07-27 09:10:12.159955
updated_at2023-07-27 10:37:48.301422
descriptionUseful extensions to convert `bool` to other Rust types
homepagehttps://wackazong.com
repositoryhttps://github.com/wackazong/bool-mappings/
max_upload_size
id927241
size4,504
wackazong (wackazong)

documentation

README

bool-mappings

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)
}

License: MIT

Commit count: 10

cargo fmt