Skip to main content

Renderer

Trait Renderer 

Source
pub trait Renderer: Send + Sync {
    type Output;
    type Context: Default;

    // Required method
    fn render(
        &self,
        service: &ServiceDef,
        intents: &[IntentScore],
        ctx: &Self::Context,
    ) -> Result<Self::Output, Error>;
}
Expand description

Trait for rendering a service definition into output of an associated type.

Implementations translate ServiceDef + scored intents into renderer-specific output. The associated Output and Context types allow renderers to operate on different targets (JSON-UI visual trees, template contexts, voice payloads, etc.) without coupling to any single output format.

Required Associated Types§

Source

type Output

The output type produced by this renderer (e.g., serde_json::Value).

Source

type Context: Default

The context type consumed by this renderer. Must implement Default.

Required Methods§

Source

fn render( &self, service: &ServiceDef, intents: &[IntentScore], ctx: &Self::Context, ) -> Result<Self::Output, Error>

Renders a service definition into the renderer’s output type.

§Arguments
  • service - The service definition to render
  • intents - Scored intents from structural analysis (sorted by confidence)
  • ctx - Rendering context (renderer-specific)
§Errors

Returns Error::Render if the rendering process fails.

Implementors§