{"id":16677939,"url":"https://github.com/dushistov/flapigen-rs","last_synced_at":"2025-12-12T13:02:33.363Z","repository":{"id":37322560,"uuid":"71988035","full_name":"Dushistov/flapigen-rs","owner":"Dushistov","description":"Tool for connecting programs or libraries written in Rust with other languages","archived":false,"fork":false,"pushed_at":"2025-01-21T15:20:19.000Z","size":10730,"stargazers_count":791,"open_issues_count":67,"forks_count":60,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-03T11:45:18.908Z","etag":null,"topics":["c","codegen","cpp","java","jni","rust","swig","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dushistov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-26T09:32:33.000Z","updated_at":"2025-04-03T07:09:32.000Z","dependencies_parsed_at":"2024-01-14T17:07:10.141Z","dependency_job_id":"bedc33a0-1316-4826-8afd-5a7c5d883d02","html_url":"https://github.com/Dushistov/flapigen-rs","commit_stats":{"total_commits":1116,"total_committers":18,"mean_commits":62.0,"dds":0.0976702508960573,"last_synced_commit":"a861f6fcd8067b75fb834cdafc6d717a92d8dca4"},"previous_names":["dushistov/rust_swig"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dushistov%2Fflapigen-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dushistov%2Fflapigen-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dushistov%2Fflapigen-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dushistov%2Fflapigen-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dushistov","download_url":"https://codeload.github.com/Dushistov/flapigen-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261925,"owners_count":21074225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","codegen","cpp","java","jni","rust","swig","wrapper"],"created_at":"2024-10-12T13:27:57.301Z","updated_at":"2025-12-12T13:02:32.713Z","avatar_url":"https://github.com/Dushistov.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flapigen [![Build Status](https://github.com/Dushistov/flapigen-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/Dushistov/flapigen-rs/actions/workflows/ci.yml) [![License](https://img.shields.io/badge/license-BSD-green.svg)](https://github.com/Dushistov/flapigen-rs/blob/master/LICENSE) [![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/flapigen)\n\n\n\nTool for connecting programs or libraries written in Rust with other languages.\nForeign language api generator - flapigen. Former name rust_swig was changed to not confuse\nwith [swig](https://github.com/swig/swig).\nCurrently implemented support for `C++` and `Java`, but you can write support\nfor any language of your choice. For an instruction how to integrate flapigen with your\nproject look [here](https://dushistov.github.io/flapigen-rs/getting-started.html).\n\nSuppose you have the following Rust code:\n\n```rust\nstruct Foo {\n    data: i32\n}\n\nimpl Foo {\n    fn new(val: i32) -\u003e Foo {\n        Foo{data: val}\n    }\n\n    fn f(\u0026self, a: i32, b: i32) -\u003e i32 {\n        self.data + a + b\n    }\n\n    fn set_field(\u0026mut self, v: i32) {\n        self.data = v;\n    }\n}\n\nfn f2(a: i32) -\u003e i32 {\n    a * 2\n}\n```\n\nand you want to write in Java something like this:\n\n```Java\nFoo foo = new Foo(5);\nint res = foo.f(1, 2);\nassert res == 8;\n```\nor in C++ something like this:\n\n```C++\nFoo foo(5);\nint res = foo.f(1, 2);\nassert(res == 8);\n```\n\nIn order to implement it flapigen suggests the following functionality,\nin Rust project you write (in Rust language):\n\n```rust\nforeign_class!(class Foo {\n    self_type Foo;\n    constructor Foo::new(_: i32) -\u003e Foo;\n    fn Foo::set_field(\u0026mut self, _: i32);\n    fn Foo::f(\u0026self, _: i32, _: i32) -\u003e i32;\n    fn f2(_: i32) -\u003e i32;\n});\n```\n\nand that's all, as a result flapigen generates JNI wrappers for Rust functions\nand Java code to call these JNI functions\nor generates C compatible wrappers in case of C++ and\nC++ code to call these C functions.\n\nIf you want the interface file (the file containing `foreign_class!` and so on)\nto be automatically generated for you, checkout [rifgen](https://crates.io/crates/rifgen).\n\n## Users Guide\n\n[📚 Read the `flapigen` users guide here! 📚](https://dushistov.github.io/flapigen-rs/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdushistov%2Fflapigen-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdushistov%2Fflapigen-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdushistov%2Fflapigen-rs/lists"}