chek: macros for checking things.

Docs

This is essentially a set of more fully-featured assert macros along the lines of assert_eq!, assert_ne!, etc. It provides better output than just performing a comparison in the assert!(...) body, in that it includes the values of the arguments on output. Unlike assert_eq!/assert_ne!, it also will log the expression strings that produced the value.

It's the successor to my more-asserts crate, which is somewhat unpleasant to use in rust 2018 without a #[macro_use] extern crate ..., due to the long module name.

Additionally, it is no_std compatible in all configurations.

Usage

Cargo features

inline_panics

This changes the assertions to panic directly, instead of calling a separate function which performs the panic. This results in better error reporting in the panic itself (it will report the correct line number / file instead of reporting that the panic happened inside the chek crate), at the cost of some additional code bloat.

This is on by default.

Assertions

The following macros all take optional formatting message args as well, e.g. check::lt!(a, b, "it should have been less because of: {}", thing). Note that even if this is provided, a and b will still be logged, so you don't need to do that manually.

License

CC0 (public domain).