DEV Community

Discussion on: Create a desktop app in Rust using Tauri and Yew

Collapse
 
tobiaskluth profile image
tobiaskluth

Hi!
Thanks for the great writeup! Excited to dip further into the topic.
As i followed along your tutorial i encountered a problem in src-tauri/src/main.rs. Defining the hello function public throws compilation error[E0255], removing the pub declaration fixes it. I'm not a 100% sure why though.

error[E0255]: the name `__cmd__hello` is defined multiple times
  --> src/main.rs:14:8
   |
13 | #[tauri::command]
   | ----------------- previous definition of the macro `__cmd__hello` here
14 | pub fn hello (name: &str) -> Result<String, String> {
   |        ^^^^^ `__cmd__hello` reimported here
   |
   = note: `__cmd__hello` must be defined only once in the macro namespace of this module
help: you can use `as` to change the binding name of the import
   |
14 | pub fn hello as other___cmd__hello (name: &str) -> Result<String, String> {
   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0255`.
error: could not compile `app` due to previous error
Enter fullscreen mode Exit fullscreen mode
Collapse
 
stevepryde profile image
Steve Pryde

I've removed the pub. Hopefully that solves the issue if anyone else is following along. I just have encountered the same thing on my travels and removed it. I guess there's no need for it to be public. It could be a bug with the proc macro or maybe it's intentional. I'm not sure.