Render

Trait Render 

Source
pub trait Render {
    type Output;

    // Required method
    fn render(
        &self,
        tree: &SyntaxTree<'_>,
        page_info: &PageInfo<'_>,
        settings: &WikitextSettings,
    ) -> Self::Output;
}
Expand description

Abstract trait for any ftml renderer.

Any structure implementing this trait represents a renderer, with whatever state it needs to perform a rendering of the inputted abstract syntax tree.

Required Associated Types§

Source

type Output

The type outputted by this renderer.

Typically this would be a string of some kind, however more complex renderers may opt to return types with more information or structure than that, if they wish.

Required Methods§

Source

fn render( &self, tree: &SyntaxTree<'_>, page_info: &PageInfo<'_>, settings: &WikitextSettings, ) -> Self::Output

Render an abstract syntax tree into its output type.

This is the main method of the trait, causing this renderer instance to perform whatever operations it requires to produce the output string.

Implementors§