Skip to main content

Formatter

Trait Formatter 

Source
pub trait Formatter {
    // Required methods
    fn format_tree(&self, tree: &str) -> String;
    fn format_file(&self, entry: &FileEntry, content: &str) -> String;
    fn wrap(&self, tree_block: Option<&str>, files_block: &str) -> String;
    fn stream_start(&self, tree_block: Option<&str>) -> String;
    fn stream_end(&self) -> String;
    fn separator(&self) -> &'static str;
}
Expand description

Trait for formatting context output.

Required Methods§

Source

fn format_tree(&self, tree: &str) -> String

Format the project tree block.

Source

fn format_file(&self, entry: &FileEntry, content: &str) -> String

Format a single file block.

Source

fn wrap(&self, tree_block: Option<&str>, files_block: &str) -> String

Wrap the tree block and files block into final output.

Source

fn stream_start(&self, tree_block: Option<&str>) -> String

Get the opening wrapper for streaming output.

Source

fn stream_end(&self) -> String

Get the closing wrapper for streaming output.

Source

fn separator(&self) -> &'static str

Get the separator between file blocks.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§