Similar to the automatic implicit conversion to boolean values in weakly typed languages
| type | impl |
|---|---|
| float | self is not 0.0 / NaN |
| integer | self != 0 |
| reference / smart pointer | inner value impl |
| raw pointer | !self.is_null |
| Option | self.is_some |
| Result | self.is_ok |
| Poll | self.is_ready |
| str / slice | self.is_empty |
| collections | self.is_empty |
| unit | false |
| bool | self |
| fn / tuple | true |
Examples
use WeakTrue;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;