1extern crate hwloc;
2
3use hwloc::{Topology, TopologyObject};
4
5fn main() {
7 let topo = Topology::new();
8
9 println!("*** Printing overall tree");
10 print_children(&topo, topo.object_at_root(), 0);
11}
12
13fn print_children(topo: &Topology, obj: &TopologyObject, depth: usize) {
14 let padding = std::iter::repeat(" ").take(depth).collect::<String>();
15 println!("{}{}: #{}", padding, obj, obj.os_index());
16
17 for i in 0..obj.arity() {
18 print_children(topo, obj.children()[i as usize], depth + 1);
19 }
20}