Closed probablykasper closed 1 year ago
Turns out macro_rules
isn't powerful enough to handle what collate_types
needs to do, so we'll have to take some inspiration from Tauri and do a similar proc macro.
I have started work on this. Will try and finish over the weekend.
Should be fixed in 9107481a475ca832fdb895e4f8c091b907b7dc36, requires using the tauri-specta-changes
branch of specta
.
Unfortunately doesn't seem to work for me, unless I'm doing something wrong:
export_to_ts(collate_types![data::get_settings], "../bindings.ts").unwrap();
failed to resolve: could not find `__specta__fn__get_settings` in `data`
could not find `__specta__fn__get_settings` in `data`
Hmm, will have to pay more attention to what the tauri's generate_handler!
does
Pretty much copied Tauri's macro code, should work on 44d5342ee7c98cc466e271a5bc548c8989d9be7f
The
collate_types!
macro doesn't let you reference commands from other modules:Tauri's
generate_handler!
macro does, so hopefully it's possible to make it work: https://github.com/tauri-apps/tauri/blob/b6027b2dd298caccd879b8abf93532ea39354077/core/tauri-macros/src/lib.rs#L49-L51