Crates.io | as_bool |
lib.rs | as_bool |
version | 0.1.3 |
source | src |
created_at | 2020-10-10 20:34:02.168984 |
updated_at | 2020-10-10 21:55:23.271352 |
description | Define how a type should be represented in a boolean context. |
homepage | |
repository | https://github.com/jecolon/as_bool |
max_upload_size | |
id | 298162 |
size | 10,000 |
Provides an expanded notion of what is true and what is false.
Specifically with the AsBool trait, which an implementing type can use to express how it should be represented in a boolean context.
This crate also provides implementations of AsBool for Rust's builtin types and collections from the Standard Library. These implementations provide a truth table similar to the Groovy Truth implemented in the Groovy programming language. The truth table can be described as follow:
true
.0
, 0.0
, f32::NAN
, f64::NAN
, and '\0'
are false
.true
.false
.true
.false
.None
is always false
.Err
is always false
.Ok
and Some
are unwrapped and the contained item is evaluated according
to the preceding rules.Documentation: https://docs.rs/as_bool