Skip to main content

Module tree

Module tree 

Source
Expand description

Tree structure support for Altium record hierarchies.

Altium records form tree structures where parent-child relationships are encoded via the OWNERINDEX parameter. This module provides:

  • RecordTree - Generic tree structure with navigation methods
  • RecordId - Unique identifier for records within a tree
  • TreeWalker - Depth-first iterator over tree nodes

§Example

use altium_format::tree::RecordTree;
use altium_format::records::sch::SchRecord;

// Build tree from flat record list
let tree = RecordTree::from_records(records);

// Navigate the tree
for (id, record) in tree.roots() {
    println!("Root: {:?}", record);
    for (child_id, child) in tree.children(id) {
        println!("  Child: {:?}", child);
    }
}

// Walk entire tree depth-first
for (id, record, depth) in tree.walk_depth_first() {
    println!("{:indent$}{:?}", "", record, indent = depth * 2);
}

Structs§

BreadthFirstWalker
Breadth-first iterator over tree nodes.
RecordId
Unique identifier for a record within a tree.
RecordTree
Generic tree structure for Altium records.
TreeWalker
Depth-first iterator over tree nodes.

Enums§

ParentRef
Reference to a parent record.

Traits§

TreeRecord
A trait for records that can participate in a tree structure.