Function new_with_root

Source
pub fn new_with_root(root: impl Into<String>) -> Tree
Expand description

Creates a new tree with a root value.

This is a convenience function that creates a new tree and immediately sets its root value, equivalent to Tree::new().root(root).

§Arguments

  • root - The root value for the tree (anything that can be converted to a String)

§Returns

A new Tree instance with the specified root value

§Examples

use lipgloss_tree;

let tree = lipgloss_tree::new_with_root("My Root");
println!("{}", tree); // Outputs: "My Root"