Skip to main content

DiagnosticsHold

Struct DiagnosticsHold 

Source
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:

  • commit writes the held records, in order, as if never held (the counts were taken at raise time and stand);
  • discard drops 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 of set_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

Source

pub fn begin() -> Self

Start holding this thread’s diagnostic records.

Source

pub fn errors_raised(&self) -> usize

Errors (a Fatal counts as one) raised since begin, those dropped after a Fatal too.

Source

pub fn fatal_raised(&self) -> bool

Whether a Fatal was raised since begin: counted (the report’s flag set) or held as a record — what defer never sets aside, and a caller taking back its work must not discard.

Source

pub fn warnings_raised(&self) -> usize

Warnings raised since begin (a suppressed one counted too).

Source

pub fn held_errors(&self) -> Vec<String>

The errors held since begin, in order: each record’s first line, without its colors.

Source

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.

Source

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.)

Source

pub fn commit(self)

Keep the scope’s diagnostics: write the held records.

Source

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).

Source

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.

Trait Implementations§

Source§

impl Drop for DiagnosticsHold

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.