7 releases

0.2.0 Mar 28, 2024
0.1.9 Feb 10, 2024
0.1.5 Nov 30, 2023

#1029 in Procedural macros

Download history 241/week @ 2023-12-24 183/week @ 2023-12-31 150/week @ 2024-01-07 203/week @ 2024-01-14 355/week @ 2024-01-21 2216/week @ 2024-01-28 1910/week @ 2024-02-04 2799/week @ 2024-02-11 2056/week @ 2024-02-18 2192/week @ 2024-02-25 2097/week @ 2024-03-03 4446/week @ 2024-03-10 5668/week @ 2024-03-17 3046/week @ 2024-03-24 3345/week @ 2024-03-31 2186/week @ 2024-04-07

14,586 downloads per month
Used in 23 crates (via equator)

MIT license

30KB
680 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

~300–750KB
~18K SLoC