flapigen-rs icon indicating copy to clipboard operation
flapigen-rs copied to clipboard

Annotating structs/methods directly

Open arrtchiu opened this issue 5 years ago • 1 comments

Most of the time I'm defining a struct in my Rust code, and defining almost exactly the same thing again in the java_glue or cpp_glue.

Seeing as most of it is usually the same, is there a technical barrier that prevents us from doing something a bit more like the way wasm_bindgen does it for JavaScript?

arrtchiu avatar Aug 22 '19 12:08 arrtchiu

Seeing as most of it is usually the same, is there a technical barrier that prevents

Main use case for rust_swig is wrapping code that not belong to crate where build.rs runs. So such kind of syntax:

#[rust_swig]
impl Foo {

is almost useless, because of it is possible to support such syntax only in the main crate, which own build.rs that invoke rust_swig. But in my case, I export ~100 foreign_class, and only 3-4 from the current crate, so I don't really see how it helps.

May be in future, when Rust compiler will become much faster it wouldn't be necessary to divide code into many crates, but for now...

So I am not against the idea, I just don't see how it helps.

Dushistov avatar Aug 22 '19 15:08 Dushistov