pub type RenderFn = Rc<RefCell<dyn FnMut(&Value) -> Result<String, RenderError>>>;Expand description
The render function signature.
Takes handler data (as JSON) and returns formatted output. The render function is a closure that captures all rendering context (format, theme, templates, etc.) so dispatch doesn’t need to know about any of it.
Uses Rc<RefCell> since CLI applications are single-threaded, and accepts
FnMut closures for flexible mutable state handling.
§Example
ⓘ
// Framework creates render handler with context captured
let render_handler = from_fn(move |data| {
match format {
Format::Json => serde_json::to_string_pretty(data),
Format::Term => render_template(template, data, theme),
// ...
}
});Aliased Type§
pub struct RenderFn { /* private fields */ }