Is your feature request related to a problem? Please describe.
The SetupHook type utilizes Fn() instead of FnOnce(), even though it is only run once. This prevents users from moving values into the setup closure on tauri::Builder, and makes it so that users have to utilize extra workarounds to achieve the result that they're looking for.
Describe the solution you'd like
Change the SetupHook type to Box<dyn FnOnce(&mut App<R>) -> Result<(), Box<dyn std::error::Error + Send>> + Send>, and change the F generic parameter in tauri::Builder::setup to FnOnce(&mut App<R>) -> Result<(), Box<dyn std::error::Error + Send>> + Send + 'static. As far as I can tell (and have tested), this should be totally possible, since setup is only run once, here.
Describe alternatives you've considered
As far as I know, there aren't really any alternatives within tauri to produce the same result without this proposed solution. If there are any that I'm not thinking of, I'd love to hear and consider them.
Additional context
Nothing that I know of.
If I am incorrect in any assumptions here or not clear enough in any part of it, please let me know :) I would also be happy to submit a PR with the needed changes if this change is desired.
Is your feature request related to a problem? Please describe.
The
SetupHooktype utilizesFn()instead ofFnOnce(), even though it is only run once. This prevents users from moving values into the setup closure ontauri::Builder, and makes it so that users have to utilize extra workarounds to achieve the result that they're looking for.Describe the solution you'd like
Change the
SetupHooktype toBox<dyn FnOnce(&mut App<R>) -> Result<(), Box<dyn std::error::Error + Send>> + Send>, and change theFgeneric parameter intauri::Builder::setuptoFnOnce(&mut App<R>) -> Result<(), Box<dyn std::error::Error + Send>> + Send + 'static. As far as I can tell (and have tested), this should be totally possible, sincesetupis only run once, here.Describe alternatives you've considered
As far as I know, there aren't really any alternatives within tauri to produce the same result without this proposed solution. If there are any that I'm not thinking of, I'd love to hear and consider them.
Additional context
Nothing that I know of.
If I am incorrect in any assumptions here or not clear enough in any part of it, please let me know :) I would also be happy to submit a PR with the needed changes if this change is desired.