-
Notifications
You must be signed in to change notification settings - Fork 202
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
Rust Bindings #1891
Comments
Existing libraries:
|
Hi!
I had always intended my client library to be for general use and hopefully
be contributed back to the main project! The project I was developing it
with (https://github.com/jbellerb/cbmix) ended up needing to be rushed out
and I haven't had the time to return to it yet. The version on Crates.io
works, but I've changed a good bit and would want to make more changes
before I would upload an 0.2. Regardless, I'm completely down to donate
anything I've made and/or help with an official crate!
From what I learned developing that crate, all OLA protocol messages have a
version header, so theoretically there's no need to tie any client library
to a specific OLA version (while I include a fairly recent OLA as a
submodule, the actual files I'm referencing haven't changed in 5 years!).
Even though the library would be decoupled from OLA, I don't really see a
reason why a Rust client couldn't live in the main repo along with the rest
of the other language clients, especially since older versions would still
be available on Crates.io. Ultimately that's an organization question best
left for you OLA developers. Same with the licencing (and I'm cool with
relicensing if needed).
Regarding threading, Rust provides quite a few different utilities to
accomplish that. I think async is the nicest to use (thinking something
like a single connection future that can be spun off on an executor and
cloneable client objects to send and receive from) but writing something
that works across all async runtimes is next to impossible and not everyone
wants to use async. Instead, most of what I ship concerns building the
actual protocol messages, along with a (limited, synchronous) client over
std::net. This approach is similar to the tungstenite crate (
https://crates.io/crates/tungstenite) which is more of a crate for writing
crates, supplemented by various sibling crates wrapping different runtimes
(tokio, async-std, etc.). I like tokio, I made the client I intend people
to use over tokio (tokio optional features flag, personally prefer features
over separate crates), although adding support for another runtime
shouldn't be much work since almost all the code can be shared.
Let me know if you have any thoughts or questions! (Also, I'm traveling
this week so I may be slow to respond, sorry!)
|
That's a good point! I guess we don't really need to worry about that then unless @peternewman sees any imminent changes.
One thing I really want to avoid is having it built with Autotools/Automake and installed with Since it is built separately the version tags don't line up. The whole OLA repo is tagged at one time. So if there is an update to the Rust binding then we have to increase the tag of the OLA version even though the changes won't touch it. Similarly if there is an update to OLA then the Rust bindings will increase in version without any changes. I think the versioning also could be confusing for the end-user. Since the proto file hasn't changed in so long, users will probably always want the latest Rust bindings regardless of the underlying OLA version. A newer binding version would probably contain bugfixes or enhancements that work with all OLA versions. However, if the version numbers match then a user will probably tend to try to match the versions and install an older Rust binding version (which is not necessarily correct here, especially if they installed OLA from a distro with a much older version of OLA).
I think we first would need to explore re-licensing the Proto definitions file. I think until we change that all code that compiles it in must be LGPL. My tendency to move it to MPL (specifically for that one Proto file and the Rust binding) is simply from looking at installations using OLA that I have built/been commissioned for so far. I don't think I would be able to complete the same projects with a Cargo-built OLA statically-linked Rust library where I have used the OLA C++ shared library in the past (this is a licensing limitation, not a technical one).
To be honest I am just getting into Rust and I haven't looked too thoroughly at your specific implementation. From what I have researched and looked at so far Tokio does seem to be the way to go (as you have implemented it in your repo). My main concern is just that the bindings should use Tokio or another Rust-native method instead of simply wrapping the C++ shared library/bindings. The C++ API contains some bits that would be difficult to integrate well into Rust. |
I'm not sure I understand this (perceived) requirement. Can you clarify? I don't believe the LGPL requires that it is possible to replace a library; it merely states that if you use a LGPL library from a program (as opposed to from another library), then the parts of the GPL that apply to availability of source etc do not apply to you (that is, you're not required to provide source code and your code is not GPL). It does not, however, state how an application links to the library; it mentions an "interface" without defining that, and a "combined work" which is a work that uses the interface combined with the library. So libraries that do static linking can be covered under the LGPL in my reading.
Not necessarily; it is certainly possible to
Definitely agree with all of that. |
I'm starting to look into some new projects in Rust. I'm willing to work on and contribute the bindings, but there are some things to think about:
0.10.x
) for now.I think I will probably start this at some point in my own repo and then I would be happy to transfer ownership or fork to another repo once I have something usable.
The text was updated successfully, but these errors were encountered: