Skip to main content

get_tree

Function get_tree 

Source
pub fn get_tree(mana_dir: &Path, root_id: &str) -> Result<TreeNode, Error>
Expand description

Build a unit hierarchy tree rooted at the given unit ID.

Returns a TreeNode with all descendants nested recursively. Only units in the active index are included (archived units are excluded).

§Errors

§Example

use mana_core::api::get_tree;
use std::path::Path;

let tree = get_tree(Path::new("/project/.mana"), "1").unwrap();
println!("{}: {} children", tree.id, tree.children.len());