Skip to main content

get_node_children

Function get_node_children 

Source
pub fn get_node_children(node: &Node) -> Vec<&Node>
Expand description

Returns direct child nodes for a given AST node.

Provides generic access to child nodes across different node types, essential for AST traversal algorithms and recursive analysis patterns.

§Arguments

  • node - AST node to extract children from

§Returns

Vector of borrowed child node references

§Performance

  • Time complexity: O(k) where k is child count
  • Memory: Allocates vector for child references
  • Typical latency: <5μs for common node types

§Examples

use perl_parser::declaration::get_node_children;
use perl_parser::ast::Node;

let node = Node::new_root();
let children = get_node_children(&node);
println!("Node has {} children", children.len());