Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Rust bindings #2076

Open
codespree opened this issue Apr 21, 2024 · 5 comments
Open

Add support for Rust bindings #2076

codespree opened this issue Apr 21, 2024 · 5 comments

Comments

@codespree
Copy link

The idea here is to generate safe, ergonomic, bindings from the UDL for a Rust consumer module (like Swift, Kotlin, Python, Ruby).

That module then invokes the methods through FFI - exposing a type-safe Rust interface.

This will allow Rust developers to generate and distribute closed source libraries written in Rust which can be consumed from Rust without resorting to plumbing such as:

  1. abi_stable - https://docs.rs/abi_stable/latest/abi_stable/
  2. Stabby - https://github.com/ZettaScaleLabs/stabby

Also, given the current state of the project, generating Rust bindings might be relatively easier than the other bindings that this project already produces.

@badboy
Copy link
Member

badboy commented Apr 22, 2024

Binding generators can be developed externally. As we do not have the need for that usecase right now, it would be up to you to do put in the work to make that happen.

@codespree
Copy link
Author

@badboy sure. I understand. It's just that this has been a long standing issue in the Rust community as can be seen:

https://internals.rust-lang.org/t/dynamically-linking-rust-crates-to-rust-crates/10369/38
rust-lang/rfcs#3075
rust-lang/rust#105586

This has been a long standing need in the Rust community, and there are many issues filed, and discussions like the ones above. This has been an unsolved problem since many, many years.

It would be great service to the Rust community if you developed the bindings.

Having used uniffi in all our internal projects, I just see you folks best positioned to solve a long standing problem and hence this issue is filed.

It's not a really important use case for us at Seventh Sense either as our server is written in Rust and consumes our lib written in rust within the same project.

But, it would be great if our server developers could consume our lib without our lib (which contains core intellectual property) being made available to them in source code form.

I also see this issue from 9 years ago:
https://bugzilla.mozilla.org/show_bug.cgi?id=1163224

Maybe you guys have solved this problem internally, but I still see this project best poised to solve this problem once and for all.

@badboy
Copy link
Member

badboy commented Apr 22, 2024

I don't doubt that it is a valid use case. But we also have only so many hours a day to do stuff and supporting our own use cases (Kotlin/Python/Swift) takes priority.
If someone wants to use UniFFI for that they will need to do the work, and we can support them by fixing bugs and adding features to UniFFI were needed.

@codespree
Copy link
Author

Ok then 🤷🏽‍♂️.

Shall we leave it open in case anyone from the community wants to take it up?

@arg0d
Copy link
Contributor

arg0d commented Apr 25, 2024

https://github.com/NordSecurity/uniffi-bindgen-cpp implements scaffolding for C++ libraries - making it possible to use uniffi for C++ libraries, and re-use Kotlin/Swift/C#/Go bindings generators. Rust bindings generator would make it possible to consume uniffi C++ libraries in Rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants