Skip to main content

BackendPresenter

Trait BackendPresenter 

Source
pub trait BackendPresenter {
    type Error: Debug + Display;

    // Required methods
    fn capabilities(&self) -> &TerminalCapabilities;
    fn write_log(&mut self, text: &str) -> Result<(), Self::Error>;
    fn present_ui(
        &mut self,
        buf: &Buffer,
        diff: Option<&BufferDiff>,
        full_repaint_hint: bool,
    ) -> Result<(), Self::Error>;

    // Provided method
    fn gc(&mut self) { ... }
}
Expand description

Presentation abstraction: UI rendering and log output.

This is the output half of the backend boundary. The runtime hands a Buffer (and optional BufferDiff) to the presenter, which emits platform-specific output (ANSI escape sequences on native, DOM mutations on web).

Required Associated Types§

Source

type Error: Debug + Display

Platform-specific error type.

Required Methods§

Source

fn capabilities(&self) -> &TerminalCapabilities

Terminal capabilities detected by this backend.

Source

fn write_log(&mut self, text: &str) -> Result<(), Self::Error>

Write a log line to the scrollback region (inline mode) or stderr.

Source

fn present_ui( &mut self, buf: &Buffer, diff: Option<&BufferDiff>, full_repaint_hint: bool, ) -> Result<(), Self::Error>

Present a UI frame.

  • buf: the full rendered buffer for this frame.
  • diff: optional pre-computed diff (backends may recompute if None).
  • full_repaint_hint: if true, the backend should skip diffing and repaint everything.

Provided Methods§

Source

fn gc(&mut self)

Optional: release resources held by the presenter (e.g., grapheme pool compaction).

Implementors§