4 releases

0.2.0 Mar 28, 2024
0.1.10 Feb 18, 2024
0.1.7 Jan 13, 2024
0.1.6 Dec 1, 2023
0.1.5 Nov 30, 2023

#696 in Rust patterns

Download history 111/week @ 2024-01-05 217/week @ 2024-01-12 296/week @ 2024-01-19 1701/week @ 2024-01-26 1717/week @ 2024-02-02 2308/week @ 2024-02-09 2382/week @ 2024-02-16 2345/week @ 2024-02-23 2128/week @ 2024-03-01 3263/week @ 2024-03-08 5946/week @ 2024-03-15 3782/week @ 2024-03-22 3102/week @ 2024-03-29 2927/week @ 2024-04-05 2659/week @ 2024-04-12 2073/week @ 2024-04-19

11,281 downloads per month
Used in 23 crates (5 directly)

MIT license

29KB
919 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

~0.4–0.8MB
~20K SLoC