9 releases (3 major breaking)
3.1.0 | Apr 29, 2024 |
---|---|
3.0.0 | Apr 28, 2024 |
2.0.0 | Apr 26, 2024 |
1.3.0 | Apr 20, 2024 |
0.1.2 | Mar 7, 2024 |
#1321 in Rust patterns
26 downloads per month
Used in 2 crates
16KB
334 lines
C Emit
C-Emit provides all its users with a polished builder API to write C Code.
lib.rs
:
The C Code Generator for Rust.
C-Emit provides a polished Builder API for generating C Code.
Example
use c_emit::{Code, CArg};
let mut code = Code::new();
code.include("stdio.h");
code.call_func_with_args("printf", vec![CArg::String("Hello, world!")]);
assert_eq!(code.to_string(), r#"
#include<stdio.h>
int main() {
printf("Hello, world!");
return 0;
}
"#.trim_start().to_string());