Skip to main content

Module render

Module render 

Source
Expand description

Renders a Spec to HTML.

Walks spec.elements by ID starting at spec.root, dispatches per-element by type_name against BUILTIN_TYPES (or the plugin registry for any type name not in that list), and lets each container recurse via render_element for its child IDs. The renderer is infallible — every failure path (missing ID, decode error, depth overflow) emits an HTML comment and returns an empty string for the offending element rather than panicking.

Per-component bodies live in:

  • render/atoms.rs — leaf renderers
  • render/containers.rs — multi-child layout components
  • render/form.rsForm, Input, Select, Checkbox, Switch, CheckboxList
  • render/data.rsTable, DataTable

Structs§

RenderResult
Plugin-asset bundle returned by render_spec_to_html_with_plugins.

Functions§

render_spec_to_html
Renders an entire Spec to a complete HTML response body. Walks from spec.root outward, escaping text content and substituting data bindings via JSON Pointer. Top-level output is wrapped in a flex-wrap container; the renderer does not emit <html> / <head> / <body> tags — the layout system supplies those. Always returns a String; never panics and never returns Result.
render_spec_to_html_with_plugins
Plugin-aware variant. Walks spec.elements to collect plugin type names, then asks the registry for their CSS/JS asset URLs. Also collects built-in init scripts (e.g. the StreamText EventSource wiring) and merges them into the scripts output even when no plugins are present.