6 releases

0.2.2 May 23, 2024
0.2.1 May 4, 2024
0.2.0 Mar 28, 2024
0.1.10 Feb 18, 2024
0.1.5 Nov 30, 2023

#7 in #condition

Download history 2212/week @ 2024-02-26 2201/week @ 2024-03-04 4664/week @ 2024-03-11 5696/week @ 2024-03-18 2730/week @ 2024-03-25 3368/week @ 2024-04-01 2598/week @ 2024-04-08 2947/week @ 2024-04-15 2651/week @ 2024-04-22 4000/week @ 2024-04-29 4079/week @ 2024-05-06 4630/week @ 2024-05-13 3772/week @ 2024-05-20 4518/week @ 2024-05-27 5043/week @ 2024-06-03 4372/week @ 2024-06-10

18,090 downloads per month
Used in 32 crates (8 directly)

MIT license

30KB
920 lines

equator

equator is an assertion library that aims to provide helpful diagnostics when multiple conditions need to be asserted at once, without short-circuiting.

Valid assertions must be of the form:

  • cond for testing a single condition,
  • all(...) for testing that multiple conditions all hold simultaneously,
  • any(...) for testing that at least one condition holds.

all and any may be arbitrarily nested.

Example

let x = 0;
let y = 1;

let a = 4;
let b = 2;

// `equator::debug_assert!` is also available for debug-only assertions
equator::assert!(all(x == y, a < b));

This should panic with an error message like

Assertion failed at path/main.rs:8:1
Assertion failed: x == y
- x = 0
- y = 1
Assertion failed: a < b
- a = 4
- b = 2

Dependencies

~285–740KB
~18K SLoC