pub trait ProcessPrinter {
    fn print_overview(
        &self,
        process: &dyn Process,
        writer: &mut dyn BinaryWrite,
        context: Option<ProcessPrinterContext>
    ) -> Option<ProcessPrinterContext>; }
Expand description

Trait for creating a custom “process printer” that formats process state in some sort of presentable format.

Typically, implementations will display process state in a text UI over some sort of terminal.

This trait also allows for experimenting with different process display formats. For example, some use cases might want more or less detail, or to encode the process state in some sort of binary format that can be expanded into a human readable format later. Other cases might want to log process state to nonvolatile storage rather than display it immediately.

Required Methods

Print a process overview to the writer. As print_overview() uses a &dyn Process to access the process, only state which can be accessed via the Process trait can be printed.

This is a synchronous function which also supports asynchronous operation. This function does not issue a callback, but the return value indicates whether the caller should call print_overview() again (after the underlying write operation finishes). This allows asynchronous implementations to still use print_overview(), while still supporting the panic handler which runs synchronously.

When print_overview() is called the first time None should be passed in for context.

Return Value

The return indicates whether print_overview() has more printing to do and should be called again. If print_overview() returns Some() then the caller should call print_overview() again (providing the returned ProcessPrinterContext as the context argument) once the writer is ready to accept more data. If print_overview() returns None, the writer indicated it accepted all output and the caller does not need to call print_overview() again to finish the printing.

Implementors