pub trait StatusBackend {
    // Required methods
    fn report(
        &mut self,
        kind: MessageKind,
        args: Arguments<'_>,
        err: Option<&Error>
    );
    fn dump_error_logs(&mut self, output: &[u8]);

    // Provided methods
    fn report_error(&mut self, err: &Error) { ... }
    fn note_highlighted(&mut self, before: &str, highlighted: &str, after: &str) { ... }
}
Expand description

A trait for accepting status messages.

Required Methods§

source

fn report( &mut self, kind: MessageKind, args: Arguments<'_>, err: Option<&Error> )

Report a message to the status backend.

If err is not None, it represents an error that somehow caused the current message to be reported. It should be displayed in some appropriate fashion.

source

fn dump_error_logs(&mut self, output: &[u8])

This is used to print TeX engine logs after it encountered errors. This should print the provided output, which may span many lines, with some clear delineation.

Provided Methods§

source

fn report_error(&mut self, err: &Error)

Report an error to the status backend.

Unlike the basic report function, in this case there is no additional contextual information provided. The default implementation delegates to report() with a generic lead-in message of “an error occurred”.

source

fn note_highlighted(&mut self, before: &str, highlighted: &str, after: &str)

Issue a note-level status, idealy highlighting a particular phrase.

This is a bit of a hack. I like the UX when we issue notes in this style. It’s a bit more high-level than intended for this trait, but we can provide a nice sensible default implementation, so whatever.

Implementors§