Expand description
Functions for condition checks similar to the design by contract philosophy to ensure logical correctness.
This module provides validation checking of function or method conditions.
A condition is a predicate which must be true just prior to the execution of some section of code - for correct behavior as per the design specification.
An anyhow::Result
is returned with a descriptive message when the
condition check fails.
Constants§
- A message prefix that can be used with calls to
expect
or other assertion-related functions.
Functions§
- Checks the values are equal.
- Checks the
u8
values are equal. - Checks the
usize
values are equal. - Checks the
f64
value is in range [l
,r
] (inclusive). - Checks the
i64
value is in range [l
,r
] (inclusive). - Checks the
u8
value is in range [l
,r
] (inclusive). - Checks the
u64
value is range [l
,r
] (inclusive). - Checks the
usize
value is in range [l
,r
] (inclusive). - Checks the
key
is in themap
. - Checks the
key
is in themap
. - Checks the
key
is not in themap
. - Checks the
key
is not in themap
. - Checks the hashmap is empty.
- Checks the map is not empty.
- Checks the
member
is in theset
. - Checks the
member
is not in theset
. - Checks the
f64
value is non-negative (< 0). - Checks the
i64
value is positive (> 0). - Checks the
u64
value is positive (> 0). - Checks the
predicate
is false. - Checks the
predicate
is true. - Checks the slice is empty.
- Checks the slice is not empty.
- Checks the string
s
contains the patternpat
. - Checks the string
s
has semantic meaning and contains only ASCII characters. - Checks the string
s
if Some, contains only ASCII characters and has semantic meaning.