https://github.com/kofituo/rifgen
https://github.com/kofituo/rifgen
c code-generation codegen flapigen java jni rust swig
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kofituo/rifgen
- Owner: Kofituo
- License: mit
- Created: 2021-09-15T12:34:04.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-13T18:08:45.000Z (about 2 years ago)
- Last Synced: 2025-01-30T18:05:55.609Z (8 months ago)
- Topics: c, code-generation, codegen, flapigen, java, jni, rust, swig
- Language: Rust
- Homepage:
- Size: 8.46 MB
- Stars: 37
- Watchers: 4
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rifgen

[](https://crates.io/crates/rifgen)
[](https://docs.rs/rifgen/)
[](https://p.hbtl.co/tHBHce)Program for translating libraries written in Rust to interface files. It works
with [flapigen](https://github.com/Dushistov/flapigen-rs). For instructions on how to integrate with your project,
click [here](https://docs.rs/rifgen/). This crate was initially [rust_interface_file_generator](https://crates.io/crates/rust_interface_file_generator/)Suppose you have the following Rust code:
```rust
struct Foo {
data: i32
}impl Foo {
fn new(val: i32) -> Foo {
Foo { data: val }
}fn f(&self, a: i32, b: i32) -> i32 {
self.data + a + b
}fn set_field(&mut self, v: i32) {
self.data = v;
}
}
```Using [flapigen](https://github.com/Dushistov/flapigen-rs), you'd have to write an interface file similar to
```rust
foreign_class!(class Foo {
self_type Foo;
constructor Foo::new(_: i32) -> Foo;
fn Foo::set_field(&mut self, _: i32);
fn Foo::f(&self, _: i32, _: i32) -> i32;
});
```in order to write in Java something like this:
```Java
Foo foo=new Foo(5);
int res=foo.f(1,2);
assert res==8;
```or in C++ something like this:
```C++
Foo foo(5);
int res = foo.f(1, 2);
assert(res == 8);
```This module generates the interface file, so you can focus more time on your code
Other Features:
✅ Fast and easy to use
✅ Specify style of the resulting code i.e. Whether CamelCase or snake_case
✅ Works, with `structs`, `enums`, `trait`
✅ You don't have to worry about the "order" in which code in the interface has to be
## Users Guide
[Read the `rifgen` users guide here!](https://docs.rs/rifgen/)
[View on crates.io](https://crates.io/crates/rifgen)
## Contact Me
If you'd like to contact me to help with any project whatsoever, you can [reach me on Upwork](https://www.upwork.com/freelancers/~0196d30a485de56f48)