games-on-whales / inputtino

A virtual input library: supports mouse, keyboard, joypad, trackpad and more
MIT License
19 stars 3 forks source link

Publish Rust bindings on crates.io. #3

Open hgaiser opened 2 months ago

hgaiser commented 2 months ago

Hey! I see you're making good progress on this :). The C API looks nice and clean from what I saw so far.

Do you have any plans on publishing the Rust bindings on crates.io? I have absolutely no idea if, or when I would like to add this to moonshine, but at the very least I would like to add it as TODO for someone to pick up.

A related question: do you have any plans to make a Rust wrapper on top of the bindings? I think they can be pretty straightforward and would help adoption in Rust :).

ABeltramo commented 2 months ago

There's already a barebone Rust project under bindings/rust. I was mainly focusing on having a working build environment using bindgen.
I'd like to first wrap all the "unsafe" code and expose a nice Rust API so that it can be easily consumed, and then eventually publish it on crates.io

hgaiser commented 2 months ago

Great :) looking forward to it.

Ps. I like to use a bindgen script instead of building the bindings dynamically, like here. Saves another dependency ;)

ABeltramo commented 2 months ago

That's interesting, what would be the difference between manually installing it with cargo and having it defined as a [build-dependencies] like I've done here? I kind of like that it basically does that step automatically for you when building the project..

hgaiser commented 2 months ago

The main advantage would be that it is one dependency less. However, for nvfbc-sys the header rarely changes so it makes more sense there. Since you're actively developing it, maybe it's better to have it build dynamically in build.rs :)