#type-definition #scan #codebase #libclang #env

type-crawler

A tool to scan C/C++ types using libclang

2 unstable releases

Uses new Rust 2024

0.1.0 Aug 23, 2025
0.0.0 Aug 9, 2025

#3 in #libclang

MIT license

54KB
1.5K SLoC

type-crawler

A library which scans for type definitions in a C/C++ codebase.

Contents

Usage

use type_crawler::{Env, EnvOptions, TypeCrawler};

let env = Env::new(EnvOptions::default());
let crawler = TypeCrawler::new(env).unwrap();
let types = crawler.parse_file("path/to/file.hpp").unwrap();

for ty in types.types() {
    println!("{ty}");
}

See the lib/tests/ directory for more examples.

Running tests

The clang crate only allows one Clang instance at a time, so tests must be run on one thread:

cargo test -- --test-threads=1

Dependencies

~1.4–2.1MB
~39K SLoC