Skip to main content

HandlerBackend

Trait HandlerBackend 

Source
pub trait HandlerBackend<W: Write> {
    // Required methods
    fn write_key(&self, key: &str, writer: &mut W) -> Result<()>;
    fn write_handler(
        &self,
        handler: &HandlerCodegen,
        writer: &mut W,
    ) -> Result<()>;
    fn begin_nested(&self, root: bool, writer: &mut W) -> Result<()>;
    fn end_nested(&self, root: bool, writer: &mut W) -> Result<()>;

    // Provided methods
    fn begin(&self, writer: &mut W) -> Result<()> { ... }
    fn end(&self, writer: &mut W) -> Result<()> { ... }
}
Expand description

Backend implementation for handlers.

Required Methods§

Source

fn write_key(&self, key: &str, writer: &mut W) -> Result<()>

Write the provided key.

Source

fn write_handler(&self, handler: &HandlerCodegen, writer: &mut W) -> Result<()>

Write the provided handler.

Source

fn begin_nested(&self, root: bool, writer: &mut W) -> Result<()>

Begin a nested handler.

If root is true, then this is the first nesting.

Source

fn end_nested(&self, root: bool, writer: &mut W) -> Result<()>

End a nested handler.

If root is true, then this is the first nesting.

Provided Methods§

Source

fn begin(&self, writer: &mut W) -> Result<()>

Optional hook which will be called at the start of this stage.

Source

fn end(&self, writer: &mut W) -> Result<()>

Optional hook which will be called at the end of this stage.

Implementors§