pub trait LogTree: Sized {
// Required method
fn add_node(&self, lvl: u8) -> Option<(String, Childs<'_, Self>)>;
// Provided methods
fn decorators(&self, lvl: u8) -> [&str; 4] { ... }
fn fmt_tree(&self) -> String { ... }
fn fmt_tree_node(&self, is_last: bool) -> String { ... }
}
Required Methods§
Sourcefn add_node(&self, lvl: u8) -> Option<(String, Childs<'_, Self>)>
fn add_node(&self, lvl: u8) -> Option<(String, Childs<'_, Self>)>
Add a node to the tree.
- Returns
None
if the node should not be added. - Returns
Some((key, childs))
if the node should be added. - where
childs
can be empty, if the node is a leaf node.
The lvl
parameter is the depth of the node in the tree.
Provided Methods§
Sourcefn decorators(&self, lvl: u8) -> [&str; 4]
fn decorators(&self, lvl: u8) -> [&str; 4]
Decorators is an array of 4 strings, used to decorate the tree.
Sourcefn fmt_tree_node(&self, is_last: bool) -> String
fn fmt_tree_node(&self, is_last: bool) -> String
Same as fmt_tree, but return the formatted string as child of tree.
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.