Expand description
RhaiSegment — the adapter that lets a compiled .rhai plugin
participate in the layout engine as a first-class
crate::segments::Segment.
Built from a CompiledPlugin + the shared Arc<Engine>:
declared_deps is promoted to &'static (per the Segment trait’s
lifetime contract) via Vec::leak once at construction. Each
render builds a fresh build_ctx mirror, invokes the script’s
render(ctx) function, and runs the returned value through
validate_return for shape enforcement.
Runtime failures (rhai errors, resource-exceeded, malformed
return) surface as SegmentError so the layout engine logs once
and hides the segment for this invocation, matching the posture of
a built-in render that returns Err.
Structs§
- Rhai
Segment - A plugin-authored segment backed by a compiled rhai script.