Calling functions on a rust object #8365
-
Is it possible to have a function that can be passed to the frontend and that can be called with invoke that works on a instance of a struct in rust? Let's take the following code as a example:
Lets ignore the fact, that this isn't compiling (because the attribute causes some errors inside of a impl block "error: Why do I want to do this? It's simple. I want to be able to create a instance of struct and have all its fields at hand to be able to manipulate them or work with them without exposing too much to the frontend because it isn't of any real importance to the frontend. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
So this doesn't work directly. The closest thing to that is to store the Connection instance in |
Beta Was this translation helpful? Give feedback.
The same as without state. Tauri will inject the state for you. So for example both of these commands are the same on the javascript side
->
invoke("my_cmd")