1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Ish — The fuzzy-equality library you never asked for.
//!
//! Sometimes things aren't quite true or false,
//! they're more like true-ish or false-ish.
//!
//! ```
//! use ish::ish;
//!
//! // Some examples of true-ish values:
//! assert!(true-ish == "TRUE");
//! assert!(true-ish == "true");
//! assert!(true-ish == "on");
//! assert!(true-ish == "YEAH");
//! assert!(true-ish == "👍");
//! assert!(true-ish == 1);
//! assert!("True" == true-ish); // Comparison works in both directions.
//!
//! // The following values are not true-ish:
//! assert!(true-ish != 0);
//! assert!(true-ish != "false");
//! assert!(true-ish != "penguins!");
//!
//! // Some examples of false-ish values:
//! assert!(false-ish == "FALSE");
//! assert!(false-ish == "off");
//! assert!(false-ish == "nope");
//! assert!(false-ish == "no");
//! assert!(false-ish == "Norway"); // Easter egg!
//! assert!(false-ish == "faLSE");
//! assert!(false-ish == "👎");
//! assert!(false-ish == 0);
//!
//! // The following values are *not* false-ish:
//! assert!(false-ish != "nopeee");
//! assert!(false-ish != 1);
//! assert!(false-ish != "true");
//! assert!(false-ish != "ferret");
//! ```
//!
//! Note that ish tries to be a *little* conservative about deciding if
//! something is `true-ish` or `false-ish`,
//! so if a value is unrecognised as either thruth-y or false-y, then it will
//! not match as equal to either `truth-ish` or `false-ish`.
pub use BoolIsh;
/// Ishable is a trait that can be implemented to indicate that a fuzzy-match type can be obtained by a value.
///
/// A type that implements Ishable has an `ish()` method that will return a fuzzy version of the object.
///
/// Currently the only provided implementation is on `bool`.
;
/// ish! The whole point of this library.
///
/// Subtract it from a bool and then compare the resulting object to integers and strings.
///
/// * `true-ish` is a vaguely truthy type.
/// * `false-ish` is a vaguely falsy type.
pub const ish: Ish = Ish;