pub trait Children {
// Required methods
fn at(&self, index: usize) -> Option<&dyn Node>;
fn length(&self) -> usize;
}
Expand description
Trait defining a collection of child nodes in a tree structure.
Children
provides the interface for accessing and querying collections
of tree nodes. Implementations can provide different storage strategies,
filtering capabilities, or views of the underlying data.
§Examples
use lipgloss_tree::{NodeChildren, Children, Leaf, Node};
let mut children = NodeChildren::new();
children.append(Box::new(Leaf::new("Item 1", false)));
children.append(Box::new(Leaf::new("Item 2", false)));
assert_eq!(children.length(), 2);
assert_eq!(children.at(0).unwrap().value(), "Item 1");