as_bool 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:
- booleans behave as expected.
- all non-zero numbers are
- non-empty strings are
- empty strings are
- non-empty collections are
- empty collections are
Someare unwrapped and the contained item is evaluated according to the preceding rules.