Skip to main content

Renderer

Trait Renderer 

Source
pub trait Renderer:
    'static
    + Send
    + Sync {
    type Theme: 'static + Send + Sync;
    type PaneRenderRegistry: 'static + Send + Sync;
}
Expand description

The host-side renderer abstraction.

Implementors are zero-sized marker types in renderer crates:

ⓘ
// in lattice-ui-tui:
pub struct TuiRenderer;
impl lattice_host::Renderer for TuiRenderer {
    type Theme = TuiTheme;
    type PaneRenderRegistry = TuiPaneRenderRegistry;
}

// in lattice-ui-gpui (Phase 5.8+):
pub struct GpuiRenderer;
impl lattice_host::Renderer for GpuiRenderer {
    type Theme = GpuiTheme;
    type PaneRenderRegistry = GpuiPaneRenderRegistry;
}

The trait is intentionally bare — every method goes through the associated types’ native APIs rather than a virtual dispatch surface. Renderer crates own their hot-path reads.

Bounds. 'static + Send + Sync so App<R> can cross threads (the LSP supervisor, syntax worker, mode dispatcher all spawn work on shared runtimes that hold references to &App<R>). The renderer marker type itself is ZST so the bounds are trivially satisfied.

Required Associated Types§

Source

type Theme: 'static + Send + Sync

Renderer-specific cached theme view. The host owns the canonical neutral [crate::ui::theme::Theme]; on every :set ui.* cascade the renderer rebuilds this cache from the neutral theme via its own From<&host::ui::theme::Theme> adapter. Reads on the per-frame paint path go straight to this typed field without indirection.

Source

type PaneRenderRegistry: 'static + Send + Sync

Renderer-specific per-mode pane-render dispatch table. The TUI’s stores function pointers shaped fn(&mut ratatui::Frame, Rect, &App<TuiRenderer>, ...); GPUI’s stores its analogous shape for the GPUI paint context. The host’s mode-activation path doesn’t care about the inside — it just owns the field on App and hands &self.pane_render_registry back to the renderer at paint time.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§