playground/
playground.rs

1use gir_parser::Repository;
2
3fn main() {
4    let paths = std::fs::read_dir("./gir-files").unwrap();
5    let mut namespaces = std::collections::HashMap::new();
6    let mut total_namespaces = 0;
7
8    for path in paths {
9        let path = path.unwrap().path();
10        let gir_file = path.file_name().unwrap().to_str().unwrap();
11
12        Repository::from_path_follow_namespaces_and_cache(&mut namespaces, gir_file, "./gir-files")
13            .unwrap();
14    }
15
16    for (name, repo) in &namespaces {
17        println!("Library: {}", repo.namespace().name());
18        println!("GIR File: {}", name);
19        println!("Version: {}", repo.namespace().version());
20        println!(
21            "Dependencies: {}",
22            repo.namespace_includes()
23                .iter()
24                .map(|n| n.as_package())
25                .collect::<Vec<_>>()
26                .join(", ")
27        );
28        println!("Classes: {}", repo.namespace().classes().len());
29
30        println!("\n             ##############             \n");
31        total_namespaces += 1;
32    }
33    println!("Total namespaces read in: {total_namespaces}");
34    println!("\n             *****************             \n");
35}