#code-generation #bindings #codegen

cmacro

A library for parsing C macros and generating Rust code

9 releases

0.2.2 Mar 20, 2023
0.2.1 Mar 20, 2023
0.1.5 Mar 19, 2023
0.1.2 Dec 8, 2022

#147 in FFI

21 downloads per month

MIT/Apache

180KB
5K SLoC

cmacro

Crates.io Documentation

This is a library for parsing C macros and converting them to Rust functions or macros.


lib.rs:

A library for parsing C macros.

This crate allows parsing C macros and converting them to Rust code.

Both function-like macros (e.g. #define FUNC(a, b, c) a + b * c) as well as variable-like macros (e.g. #define VAR 4 + 7 * 82) are supported.

See FnMacro and VarMacro on how to parse macros.

Dependencies

~2.5MB
~51K SLoC