Crates.io | cmacros |
lib.rs | cmacros |
version | 0.1.0 |
source | src |
created_at | 2015-06-20 23:31:09.194011 |
updated_at | 2015-12-11 23:58:10.571132 |
description | Functions for parsing #define macros from C headers and translating them to Rust code |
homepage | |
repository | https://github.com/robertknight/rust-cmacros |
max_upload_size | |
id | 2430 |
size | 15,142 |
Rust library to assist with parsing and translating #define macro definitions from C header files to corresponding Rust code for use with bindings to external libraries.
To use libraries with a C interface from Rust, rust-bindgen can be used to generate Rust bindings automatically. It does not translate constants or functions defined as macros in C headers to Rust code however.
rust-cmacros is a simple and fairly dumb library which helps to fill this gap.
It has two basic functions:
extract_macros()
parses the source of a C header file and extracts C macro definitionsgenerate_rust_src()
takes as input a set of extracted macros and a translator function
and generates Rust code.