#tauri #events #leptos #command #wasm #back-end

nightly macro tauri-interop-macro

Macros for the tauri-interop crate

11 stable releases

2.1.4 Mar 20, 2024
2.1.3 Mar 17, 2024
1.3.0 Dec 26, 2023
1.2.0 Nov 27, 2023

#1837 in Procedural macros

Download history 7/week @ 2023-12-27 4/week @ 2024-02-21 18/week @ 2024-02-28 14/week @ 2024-03-06 614/week @ 2024-03-13 273/week @ 2024-03-20 12/week @ 2024-03-27 23/week @ 2024-04-03

349 downloads per month
Used in tauri-interop

MIT/Apache

35KB
718 lines

Tauri-Interop

Latest version Documentation License

This crate tries to provide a general more enjoyable experience for developing tauri apps with a rust frontend.

tbf it is a saner approach to write the app in a mix of js + rust, because the frameworks are more mature, there are way more devs who have experience with js and their respective frameworks etc...

but tbh... just because something is saner, doesn't stop us from doing things differently ^ヮ^

Writing an app in a single language gives us the option of building a common crate/module which connects the backend and frontend. A common model itself can most of the time be easily compiled to both architectures (arch's) when the types are compatible with both. The commands on the other hand don't have an option to be compiled to wasm. Which means they need to be handled manually or be called via a wrapper/helper each time.

The crates therefore provides the following features:

  • generate a wasm function out of the defined tauri-command
  • collect and register all defined tauri-commands
  • QOL-macros to exclude multiple imports in wasm or the host architecture
  • easier usage of tauri's event feature

Note

The library uses a resolver 2 features to allow easy inclusion without configuration. When working with virtual workspaces the resolver defaults to 1. In that case it is required to set the resolver manually to version 2,
otherwise the target specific compilation will not resolve correctly. When the wrong resolver is used, an error should state that the Listen trait is missing.


lib.rs:

The macros use by tauri-interop to generate dynamic code depending on the target

Without tauri-interop the generated code can't compile.

Dependencies

~1–1.4MB
~27K SLoC