pub trait TreeDisplay {
// Required method
fn tree_print(&self, f: &mut Formatter<'_>, depth: TreeState) -> Result;
// Provided methods
fn print_tree(&self, f: &mut Formatter<'_>, shorten: bool) -> Result { ... }
fn write_tree(&self, f: &mut impl Write) -> Result<()> { ... }
}
Expand description
Trait for displaying a tree
Required Methods§
Sourcefn tree_print(&self, f: &mut Formatter<'_>, depth: TreeState) -> Result
fn tree_print(&self, f: &mut Formatter<'_>, depth: TreeState) -> Result
Write item into f
and use {:depth$}
syntax in front of your single line
output to get proper indention.
Provided Methods§
Sourcefn print_tree(&self, f: &mut Formatter<'_>, shorten: bool) -> Result
fn print_tree(&self, f: &mut Formatter<'_>, shorten: bool) -> Result
Display as tree starting at depth 0
.
Sourcefn write_tree(&self, f: &mut impl Write) -> Result<()>
fn write_tree(&self, f: &mut impl Write) -> Result<()>
Display as tree starting at depth 0
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.