Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rust-diplomat/diplomat
Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code
https://github.com/rust-diplomat/diplomat
hacktoberfest
Last synced: 2 months ago
JSON representation
Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code
- Host: GitHub
- URL: https://github.com/rust-diplomat/diplomat
- Owner: rust-diplomat
- License: other
- Created: 2021-06-15T21:23:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-07T20:58:56.000Z (2 months ago)
- Last Synced: 2024-11-07T21:36:53.538Z (2 months ago)
- Topics: hacktoberfest
- Language: Rust
- Homepage: https://rust-diplomat.github.io/book/
- Size: 3.1 MB
- Stars: 529
- Watchers: 17
- Forks: 51
- Open Issues: 99
-
Metadata Files:
- Readme: README.md
- Contributing: ContributingOnWindows.md
- License: LICENSE
- Support: support/functions.ds
Awesome Lists containing this project
- awesome-dotnet-machine-learning - Diplomat - diplomat/diplomat?style=social"/> : Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code. (Uncategorized / Uncategorized)
- awesome-rust-list - Diplomat - diplomat/diplomat?style=social"/> : Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code. (FFI Bindings)
- awesome-rust-list - Diplomat - diplomat/diplomat?style=social"/> : Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code. (FFI Bindings)
README
# Diplomat
Diplomat is an experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code. With Diplomat, you can simply define Rust APIs to be exposed over FFI and get high-level C, C++, and JavaScript bindings automatically!Diplomat supports languages through a plugin interface that makes it easy to add support for your favourite language. See `tool/src/{c, cpp, js}` for examples of existing language plugins.
## Installation
First, install the CLI tool for generating bindings:
```bash
$ cargo install diplomat-tool
```Then, add the Diplomat macro and runtime as dependencies to your project:
```toml
diplomat = "0.4.0"
diplomat-runtime = "0.4.0"
```## Getting Started
Documentation on how to use Diplomat can be found [in the book](https://rust-diplomat.github.io/book/).
### Architecture
See the [design doc](docs/design_doc.md) for more details.### Building and Testing
Simply run `cargo build` to build all the libraries and compile an example. To run unit tests, run `cargo test`.Diplomat makes use of snapshot tests to check macro and code generation logic. When code generation logic changes and the snapshots need to be updated, run `cargo insta review` (run `cargo install cargo-insta` to get the tool) to view the changes and update the snapshots.