Debian Codegraph @

.cargo/vendor/equator-macro/README.md

raw
1 # equator
2
3 `equator` is an assertion library that aims to provide helpful diagnostics when
4 multiple conditions need to be asserted at once, without short-circuiting.
5
6 Valid assertions must be of the form:
7
8 - `cond` for testing a single condition,
9 - `all(...)` for testing that multiple conditions all hold simultaneously,
10 - `any(...)` for testing that at least one condition holds.
11
12 `all` and `any` may be arbitrarily nested.
13
14 # Example
15 ```
16 let x = 0;
17 let y = 1;
18
19 let a = 4;
20 let b = 2;
21
22 // `equator::debug_assert!` is also available for debug-only assertions
23 equator::assert!(all(x == y, a < b));
24 ```
25
26 This should panic with an error message like
27 ```
28 Assertion failed at path/main.rs:8:1
29 Assertion failed: x == y
30 - x = 0
31 - y = 1
32 Assertion failed: a < b
33 - a = 4
34 - b = 2
35 ```