The FFI for this changed upstream. Instead of registering a single function that inputs a single buffer packed with all arguments, you now register a function for each method where there is a 1-1 mapping of arguments. The entire interface is represented by a "vtable" -- AKA a struct that has a field for each of the method handler functions To implement the methods, I stole the pattern we were using for regular calls where we define a base class that's implemented by normal code and a subclass that's implemented by generated code. Registering/deregistering callback interfaces is now handled by the generated code directly. It's simpler this way and now that we don't have the split between regular and fixture scaffolding, there's not much need for shared code to handle this. Kept the decision before to only support "fire-and-forget" callbacks. I think we will want to revisit this when the we support UniFFI async, but we can save that for later. Differential Revision: https://phabricator.services.mozilla.com/D222027
uniffi-js
This directory contains C++ helper code for the UniFFI Rust library (https://github.com/mozilla/uniffi-rs/).
-
UniFFIPointer.*andUniFFIPointerType.*implement theUniFFIPointerWebIDL class -
UniFFI*Scaffolding.cppimplements theUniFFIScaffoldingWebIDL class.- UniFFIGeneratedScaffolding.cpp contains the generated C++ code
- UniFFIScaffolding.cpp is a facade that wraps UniFFIFixtureScaffolding, and UniFFIGeneratedScaffolding if enabled, to implement the interface.
-
ScaffoldingConverter.hcontain helper code to convert values between JS and Rust. This is used by the generated code to make scaffolding calls. -
OwnedRustBuffer.*implements a C++ class to help manager ownership of a RustBuffer. -
UniFFIRust.hcontains definitions for the C functions that UniFFI exports.