Skip to main content

OutputFormatter

Trait OutputFormatter 

Source
pub trait OutputFormatter {
    // Required method
    fn write_tree(
        &self,
        root: &TreeNode,
        root_name: &str,
        opts: &Options,
        out: &mut dyn Write,
    ) -> Result<TreeStats>;
}
Expand description

Renders a complete TreeNode tree into the supplied writer.

Each implementation produces a different output format (tree, flat, JSON). Library consumers can implement this trait to supply custom formats.

Required Methods§

Source

fn write_tree( &self, root: &TreeNode, root_name: &str, opts: &Options, out: &mut dyn Write, ) -> Result<TreeStats>

Render a complete tree into out.

Implementations receive the root TreeNode (already fully built), the display name of the root path, the active options, and the output writer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§