pub struct DiagnosticsHold { /* private fields */ }Expand description
A speculative scope’s diagnostics, held until the caller decides whether
the scope’s RESULT is kept. For work the engine runs on its own initiative
in a state the document never produces — the \maketitle deposit replays
a class’s dropped title body with the title fields emptied — so that its
diagnostics are the document’s exactly when its output is:
commitwrites the held records, in order, as if never held (the counts were taken at raise time and stand);discarddrops them AND restores the report counts — and the runaway guards beside them — to the snapshot, so the log and the status agree that nothing was raised (the whole-diagnostic rule ofset_ignore_diagnostics). Only diagnostics are rolled back, with the error stubs that stand in for them (an undefined control sequence’s<ltx:ERROR/>definition, installed globally: kept, it would turn the document’s own later use of that command into an uncounted error). The scope’s other side effects (a global assignment it made) stay.
Holds nest (a commit writes into the enclosing hold). Dropping an
unresolved hold commits it, so a panic or an early return cannot lose a
diagnostic. Progress notes ((Loading …)) are never held.
Implementations§
Source§impl DiagnosticsHold
impl DiagnosticsHold
Sourcepub fn errors_raised(&self) -> usize
pub fn errors_raised(&self) -> usize
Errors (a Fatal counts as one) raised since begin, those dropped after a Fatal too.
Sourcepub fn fatal_raised(&self) -> bool
pub fn fatal_raised(&self) -> bool
Sourcepub fn warnings_raised(&self) -> usize
pub fn warnings_raised(&self) -> usize
Warnings raised since begin (a suppressed one counted too).
Sourcepub fn held_errors(&self) -> Vec<String>
pub fn held_errors(&self) -> Vec<String>
The errors held since begin, in order: each record’s first line, without its colors.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
The scope raised no diagnostic since begin: nothing held, nothing counted (a suppressed
Warning is counted without a record), no Error dropped after a Fatal.
Sourcepub fn is_empty_but_debug(&self) -> bool
pub fn is_empty_but_debug(&self) -> bool
The scope raised nothing but Debug messages (counted, never written): is_empty but for those.
A held tag whose typesetting only traced itself holds nothing to defer (latexml_engine tags_refnums.rs
\lx@tag@intags@held).
(An Error dropped after a Fatal is not counted here, unlike is_empty: it left nothing to
defer.)
Sourcepub fn defer(self) -> Option<DeferredDiagnostics>
pub fn defer(self) -> Option<DeferredDiagnostics>
Set the scope’s diagnostics aside until their use (DeferredDiagnostics): records and counts are taken back as
discard takes them — the error stubs too, so a later use of the command raises its own error
— and kept to be replayed (replay_shown_deferred). A Fatal is never deferred: it is committed (None).
Sourcepub fn discard(self) -> usize
pub fn discard(self) -> usize
Drop the scope’s diagnostics, records and counts alike — with the
runaway gates beside the counts (DiagnosticGates). Returns how many
records were dropped.