Skip to main content

Transform

Trait Transform 

Source
pub trait Transform: Send + Sync {
    // Required methods
    fn input(&self) -> TreeKind;
    fn output(&self) -> TreeKind;
    fn run<'a>(
        &self,
        tree: Tree<'a>,
        file: &mut File,
        alloc: &'a Allocator,
    ) -> Result<Tree<'a>, Error>;

    // Provided methods
    fn start<'a>(
        &self,
        tree: Tree<'a>,
        file: &mut File,
        alloc: &'a Allocator,
    ) -> Result<Step<'a>, Error> { ... }
    fn host(&self) -> Option<u32> { ... }
    fn html_writer(&self, _target: HtmlTarget) -> Option<Box<dyn HtmlWriter>> { ... }
}
Expand description

Changes a tree, or bridges it into another kind of tree.

Required Methods§

Source

fn input(&self) -> TreeKind

Source

fn output(&self) -> TreeKind

Source

fn run<'a>( &self, tree: Tree<'a>, file: &mut File, alloc: &'a Allocator, ) -> Result<Tree<'a>, Error>

Provided Methods§

Source

fn start<'a>( &self, tree: Tree<'a>, file: &mut File, alloc: &'a Allocator, ) -> Result<Step<'a>, Error>

Start the stage: a finished tree, or a job when its work is asynchronous.

Source

fn host(&self) -> Option<u32>

The id of the binding function this stage stands for, which takes and returns whatever tree reaches it; None for a stage the crate runs.

Source

fn html_writer(&self, _target: HtmlTarget) -> Option<Box<dyn HtmlWriter>>

Something that writes, from this stage’s input, the HTML a compiler aiming at target would write from its output, when the stage can skip building that tree.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§