Open Bug 1732341 Opened 3 years ago Updated 3 years ago

Investigate adding semantic analysis and linkage support for UniFFI rust glue layer

Categories

(Webtools :: Searchfox, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: asuth, Unassigned)

References

(Depends on 1 open bug)

Details

https://github.com/mozilla/uniffi-rs is a new tool to provide bindings between rust implementations and the various Firefox native platforms. From the docs at https://mozilla.github.io/uniffi-rs/ it looks like that on desktop it produces XPCOM bindings that searchfox should already understand, but it likely would be useful to have a first-class understanding of UniFFI IDL so that people don't need to click through the binding/glue layer and that things could potentially work across all platforms.

Update: From discussion, it seems like there's a proposal to potentially replace the IDL with rust annotations at https://github.com/mozilla/uniffi-rs/issues/385 but this would still likely require searchfox to understand those annotations at some level. (Ideally the UniFFI tooling would generate the semantic JSON searchfox would want to consume, etc.)

Wow, I think this would be a great feature, but right now I don't believe UniFFI is producing XPCOM bindings. I think that's referring to the gecko-js backend, which was recently removed. That backend was fairly promising, but we weren't actively using and maintaining it. I think it could come back at some point, but AFAIK there are no plans to do that yet.

Maybe we should pick this up again. We're currently working on a second effort for getting UniFFI to produce JS bindings on Desktop and I'm expecting/hoping to land it over the next few months. It would be great to discuss how to integrate this with searchfox.

The new effort is going going to produce a JSM module that contains the bindings, which depends on a low-level WebIDL interface for calling into Rust. I don't think it's worth documenting the WebIDL interface, but it would be great to document the JSM module. That module will have the same API as the Rust code, which should be documented. I'm not sure what the best UI is for searchfox, but I'm happy to help support it. One wrinkle here is the JSM module is going to be auto-generated, not sure how that affects searchfox.

BTW, there's another potential project in the works to copy the documentation from the Rust code to the bindings code. Could this help?

You need to log in before you can comment on or make changes to this bug.