Autogenerate C++ bindings for authrs_bridge
Categories
(Core :: DOM: Web Authentication, enhancement, P3)
Tracking
()
People
(Reporter: jschanck, Unassigned)
Details
Attachments
(1 file)
We should use cbindgen to create bindings for authrs_transport_constructor and authrs_webauthn_att_obj_constructor. There's a very minor obstacle to doing this at the moment. That is
- the rust side defines its out parameters as
*mut *const T, - cbindgen produces a header with out params of type
const T**, and - the C++ side uses
getterAddRefswhich converts toT **.
This results in a compile error:
candidate function not viable: no known conversion from 'nsGetterAddRefs<T>' to 'const T **' .
| Reporter | ||
Comment 1•2 years ago
|
||
Comment 2•2 years ago
|
||
If that's the only blocker, we could define the rust function to use *mut *mut T, right? It should automatically coerce to *mut *const T if needed.
| Reporter | ||
Comment 3•2 years ago
|
||
The compiler won't automatically coerce the inner pointer type, but using *mut *mut T and manually coercing is certainly one solution.
FWIW, there are a number of other instances of this pattern, and most of those could benefit from automatic binding generation.
Comment 4•2 years ago
|
||
An even better alternative would be to make getterAddrefs coerce to const T**, I guess.
Description
•