Skip to main content

DirectiveFactory

Trait DirectiveFactory 

Source
pub trait DirectiveFactory:
    Sized
    + Debug
    + Clone
    + PartialEq
    + 'static {
    // Required methods
    fn open(
        reader: &mut Reader<'_>,
        info: &TagInfo<'_>,
    ) -> Result<Self, SyntaxError>;
    fn render(
        &self,
        ctx: &mut (dyn Context + 'static),
        nodes: &[Node],
        branches: &[Element],
    ) -> Result<String, Box<dyn RuntimeError>>;

    // Provided methods
    fn branch(
        _tags: &[TagInfo<'_>],
        _info: &TagInfo<'_>,
    ) -> Result<(), SyntaxError> { ... }
    fn close(
        &mut self,
        _reader: &mut Reader<'_>,
        _info: &TagInfo<'_>,
    ) -> Result<(), SyntaxError> { ... }
}

Required Methods§

Source

fn open( reader: &mut Reader<'_>, info: &TagInfo<'_>, ) -> Result<Self, SyntaxError>

Source

fn render( &self, ctx: &mut (dyn Context + 'static), nodes: &[Node], branches: &[Element], ) -> Result<String, Box<dyn RuntimeError>>

Provided Methods§

Source

fn branch(_tags: &[TagInfo<'_>], _info: &TagInfo<'_>) -> Result<(), SyntaxError>

Source

fn close( &mut self, _reader: &mut Reader<'_>, _info: &TagInfo<'_>, ) -> Result<(), SyntaxError>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§