Crates.io | bool-mappings |
lib.rs | bool-mappings |
version | 0.1.2 |
source | src |
created_at | 2023-07-27 09:10:12.159955 |
updated_at | 2023-07-27 10:37:48.301422 |
description | Useful extensions to convert `bool` to other Rust types |
homepage | https://wackazong.com |
repository | https://github.com/wackazong/bool-mappings/ |
max_upload_size | |
id | 927241 |
size | 4,504 |
Useful extensions to convert bool
to other Rust types.
At the moment there are two extensions:
.true_or()
.false_or()
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