15 unstable releases (3 breaking)

0.4.1 Aug 4, 2024
0.4.0 Aug 4, 2024
0.3.4 Aug 3, 2024
0.2.1 May 4, 2024
0.1.5 Nov 30, 2023

#1116 in Procedural macros

Download history 6004/week @ 2024-08-17 8148/week @ 2024-08-24 9743/week @ 2024-08-31 9162/week @ 2024-09-07 7238/week @ 2024-09-14 6711/week @ 2024-09-21 6798/week @ 2024-09-28 6995/week @ 2024-10-05 7349/week @ 2024-10-12 7869/week @ 2024-10-19 8945/week @ 2024-10-26 12659/week @ 2024-11-02 10620/week @ 2024-11-09 15972/week @ 2024-11-16 30248/week @ 2024-11-23 37843/week @ 2024-11-30

97,474 downloads per month
Used in 99 crates (via equator)

MIT license

32KB
803 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

~215–650KB
~15K SLoC