Skip to main content

Module capture

Module capture 

Source
Expand description

Per-thread capture of Print output, for a parallel checker that releases output in TLC’s sequential order.

While a PrintCapture is active on a thread, Print, PrintT and the evaluator’s once-per-run warnings evaluated on that thread go into the capture instead of the evaluator’s sink. The checker drains the capture at the boundaries of the reference order (before a successor, after its constraints, after its invariants, …), tags each batch with its position, and later releases the batches in position order through crate::Evaluator::release.

Warnings are printed once per run. Which evaluation prints a warning must not depend on scheduling, so a captured warning is not checked against the run’s warning history when it is raised: Captured::warning marks it, and crate::Evaluator::release keeps it only if it is the first of its text released in the run.

use dive_eval::capture::PrintCapture;

let cap = PrintCapture::start();
assert!(cap.take().is_empty());
drop(cap); // output goes to the evaluator's sink again

Structs§

Captured
One captured line.
PrintCapture
Captures Print output on the current thread while it lives. Captures nest: dropping one restores the enclosing capture, whose lines are kept.