pub type Enumerator = fn(&dyn Children, usize) -> String;
Expand description
Function type for generating tree branch characters.
An Enumerator
takes a children collection and an index, then returns
the appropriate branch character string for that position. Typically,
the last child in a sequence gets a different character (└──) than
intermediate children (├──).
§Arguments
children
- The children collection being enumeratedindex
- The zero-based index of the current child
§Returns
A string representing the branch character(s) for this position
§Examples
use lipgloss_tree::{Children, Enumerator};
let custom_enumerator: Enumerator = |children, index| {
if index == children.length() - 1 {
"└──".to_string() // Last child
} else {
"├──".to_string() // Intermediate child
}
};