pub fn assertions() -> impl Iterator<Item = Assertion>Expand description
Every assertion declaration compiled into this binary.
These are the assertions that antithesis_init()
registers, read without emitting anything and without init having run.
The order is the linker’s, the same order init registers them in: fixed
for a given binary, but free to change between builds. Sort by
Assertion::location if you need an order that survives rebuilds.
Without the full feature the catalog is always empty.
use antithesis_sdk::{assert_sometimes, catalog};
// Never called, yet its assertion is still in the catalog.
#[allow(dead_code)]
fn never_called(x: u64) {
assert_sometimes!(x > 3, "x exceeds three");
}
for assertion in catalog::assertions() {
println!(
"{:?} {:?} at {}:{}",
assertion.kind, assertion.message,
assertion.location.file, assertion.location.begin_line
);
}