Skip to content

Commit

Permalink
Create a uniffi-bindgen crate (#44)
Browse files Browse the repository at this point in the history
We will be using [`uniffi-rs`](https://github.com/mozilla/uniffi-rs) to generate bindings, allowing foreign languages to be able to call into our Rust code.

For more information on `uniffi`, check out their excellent user guide:
https://mozilla.github.io/uniffi-rs/Overview.html

This PR does the setup for multi-crate workspace, as outlined in their user guide here:
https://mozilla.github.io/uniffi-rs/tutorial/foreign_language_bindings.html#multi-crate-workspaces
  • Loading branch information
amika-sq authored Dec 6, 2023
1 parent 3dfa311 commit acd02a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ license-file = "LICENSE"
thiserror = "1.0.50"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde_with = "3.4.0"
serde_with = "3.4.0"

# Update to released version once foreign traits are included (likely 0.26.0).
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "7cd3aac735e905e1725d350a7a82d57aa50caaa1" }
11 changes: 11 additions & 0 deletions bindings/uniffi-bindgen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "uniffi-bindgen"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "uniffi-bindgen"
path = "src/uniffi-bindgen.rs"

[dependencies]
uniffi = { workspace = true, features = ["cli"] }
3 changes: 3 additions & 0 deletions bindings/uniffi-bindgen/src/uniffi-bindgen.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
uniffi::uniffi_bindgen_main()
}

0 comments on commit acd02a9

Please sign in to comment.