Renderer

Trait Renderer 

Source
pub trait Renderer {
    // Required methods
    fn render_value(&self, value: &Value, opts: &RenderOptions) -> String;
    fn render_builder(&self, spec: &BuilderSpec, opts: &RenderOptions) -> String;
    fn render_block(&self, block: &Block, opts: &RenderOptions) -> String;
    fn render_constructor(&self, ctor: &Constructor) -> String;
    fn render_terminal(&self, terminal: &Terminal) -> String;

    // Provided method
    fn transform_method_name(&self, name: &str) -> String { ... }
}
Expand description

Trait for language-specific rendering of expressions.

Implement this trait to support a new target language.

Required Methods§

Source

fn render_value(&self, value: &Value, opts: &RenderOptions) -> String

Render a value to a string.

Source

fn render_builder(&self, spec: &BuilderSpec, opts: &RenderOptions) -> String

Render a builder specification to a string.

Source

fn render_block(&self, block: &Block, opts: &RenderOptions) -> String

Render a block expression to a string.

Source

fn render_constructor(&self, ctor: &Constructor) -> String

Render a constructor to a string.

Source

fn render_terminal(&self, terminal: &Terminal) -> String

Render terminal operations (await, try, build method).

Provided Methods§

Source

fn transform_method_name(&self, name: &str) -> String

Transform a method name to the target language convention.

Default implementation returns the name as-is (snake_case).

Implementors§