pub trait TreeItem: Clone {
type Child: TreeItem;
fn write_self<W: Write>(&self, f: &mut W, style: &Style) -> Result<()>;
fn children(&self) -> Cow<'_, [Self::Child]>;
}Expand description
Main trait for exposing a tree structure to ptree
Associated Types
Required methods
Write the item’s own contents (without children) to f
The function returns an io::Result<()>, so calls to f.write and
write! can be chained with ?.
The provided style may be used for formatting hints.
Usually, everything printed should be run through style.paint.
However, this is not enforced, and custom implementations may choose to format
only parts of the output, apply its own formatting in combination with the provided
config, or ignore formatting altogether.