Skip to main content

write

Function write 

Source
pub fn write<W: Write>(out: W) -> Result<()>
Expand description

Writes the assertions of assertions() to out as JSON lines.

Each line is the catalog-registration event that antithesis_init() emits for that assertion, produced by the same serialization path and in the same order. Init additionally writes the antithesis_sdk version header first and the guidance registrations of the numeric and boolean macros last; neither describes an assertion, so they are left out here.

Nothing is sent to the Antithesis environment or to the local output file, and init need not have run. Without the full feature nothing is written.

For a checked-in golden file, sort the lines first: their order is the linker’s and can change between builds. Two further caveats: file is whatever file!() produced at compile time, which depends on how the build was invoked (for example --remap-path-prefix), and function comes from std::any::type_name, whose exact form is not guaranteed stable across compiler versions.