Coder Social home page Coder Social logo

rifgen's Introduction

rifgen

Rust doc Rust Documentation donate

Program for translating libraries written in Rust to interface files. It works with flapigen. For instructions on how to integrate with your project, click here. This crate was initially rust_interface_file_generator

Suppose you have the following Rust code:

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, you'd have to write an interface file similar to

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:

Foo foo=new Foo(5);
        int res=foo.f(1,2);
        assert res==8;

or in C++ something like this:

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!

View on crates.io

Contact Me

If you'd like to contact me to help with any project whatsoever, you can reach me on Upwork

rifgen's People

Contributors

kofituo avatar rvbiljouw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.