Condition Utils
cond_utils
is a very simple crate that provides two traits with comparation utils: Between
and In
.
The objective of cond_utils
is to simplify and make more legible some common tasks, like comparing if a value lies between two limits, or checking if a value is in a set. This allows us to write code like:
use Between;
let number = 6;
if number.between
instead of:
let number = 6;
if number > 0 && number < 10
This:
use In;
let number = 6;
if number.is_in
instead of:
let number = 6;
if number == 2 || number == 6 || number == 12
Or this:
use In;
let number = 6;
if number.in_ranges
instead of:
let number = 6;
if ||
It works with any type that implements PartialEq
+ PartialOrd
+ Sized
traits.