Skip to main content

Crate datagrout_panels_egui

Crate datagrout_panels_egui 

Source
Expand description

Render DataGrout Smart Panels with egui.

§Why immediate mode

egui redraws from state every frame with no retained widget tree. A Smart Panel re-derives its panel_source from the rulebase on every load, with no retained DOM. They are the same architecture — so rendering one with the other costs no reconciliation, unlike a renderer that must diff panel facts into a persistent element tree.

One function per kind, dispatched by render_panel. Every renderer is pure: it reads the panel and draws. Nothing here fetches, caches, or mutates.

Form fields report interaction through PanelAction rather than acting on it, so the caller decides what a submit means. This crate has no transport and must not grow one.

§Where the panels come from

Panels are published to DataGrout with the gateway’s smart_panel.publish tool and read back with smart_panel.list; that response becomes Panel values via datagrout_panels::Panel::all_from_list. Bring your own MCP client — neither crate has a transport. A hand-written list response works too, which is the quickest way to see this renderer draw something.

use datagrout_panels::Panel;
use datagrout_panels_egui::render_panel;

let panels = Panel::all_from_list(&list_response);

egui::CentralPanel::default().show(ctx, |ui| {
    for panel in &panels {
        render_panel(ui, panel);
    }
});

Structs§

FormState
Mutable per-viewer form state. Kept by the caller across frames — immediate mode means the widgets themselves hold nothing.

Enums§

PanelAction
Something a viewer did that the host application must act on.

Functions§

render_panel
Render a panel. Returns any actions the viewer triggered this frame.
render_panel_with_state
Render a panel with caller-held form state.