8 releases

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

#1071 in Procedural macros

Download history 5415/week @ 2024-03-14 4578/week @ 2024-03-21 2775/week @ 2024-03-28 3460/week @ 2024-04-04 2647/week @ 2024-04-11 2526/week @ 2024-04-18 3332/week @ 2024-04-25 4116/week @ 2024-05-02 5003/week @ 2024-05-09 3695/week @ 2024-05-16 4180/week @ 2024-05-23 4489/week @ 2024-05-30 5068/week @ 2024-06-06 4293/week @ 2024-06-13 6105/week @ 2024-06-20 5003/week @ 2024-06-27

21,300 downloads per month
Used in 34 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

~320–780KB
~19K SLoC