Skip to main content

Renderable

Trait Renderable 

Source
pub trait Renderable: Send + Sync {
    // Required methods
    fn render(&self, bindings: &HashMap<String, String>) -> Result<String>;
    fn name(&self) -> &str;

    // Provided method
    fn source(&self) -> Option<&str> { ... }
}
Expand description

Trait for template rendering

Abstracts template rendering with context bindings. Implementors transform query bindings into rendered output.

Required Methods§

Source

fn render(&self, bindings: &HashMap<String, String>) -> Result<String>

Render template with given context bindings

§Arguments
  • bindings - Query variable bindings (e.g., {“className”: “TestClass”, …})
§Returns

Rendered content (typically source code)

Source

fn name(&self) -> &str

Template name for logging/auditing

Provided Methods§

Source

fn source(&self) -> Option<&str>

Optional: template source for debugging

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§