tenho o seguinte código tauri v2


use std::{fs, path::Path, io::BufReader, io::Read};
use reqwest::blocking::get;
use std::io::Write;
use serde::Serialize;
use tauri::Emitter;

#[derive(Serialize, Clone)]
pub struct DownloadProgress {
    pub status_message: String,
    pub current_file: usize,
    pub total_files: usize,
    pub file_name: String,
    pub downloaded_bytes: u64,
    pub total_bytes: u64,
}

#[tauri::command]
fn start_download(app_handle: tauri::AppHandle) -> Result<(), String> {
    let patch_file = "patch.lua";

    // Lendo o arquivo patch.lua
    let content = fs::read_to_string(patch_file).map_err(|_| "Falha ao ler patch.lua")?;

    // Parse do arquivo patch.lua
    let updates = lua::parse_updates(&content)?;

    // Criar pasta "patch" caso não exista
    let patch_dir = Path::new("patch");
    if !patch_dir.exists() {
        fs::create_dir(&patch_dir).map_err(|_| "Não foi possível criar a pasta patch")?;
    }

    // Total de arquivos
    let total_files = updates.len();

    for (current_file, update) in updates.iter().enumerate() {
        let file_name = &update.file_name;
        let url = format!("https://hil-speed.hetzner.com/{}", file_name);
        let destination = patch_dir.join(&update.file_name);

        // Emitir status inicial
        app_handle
            .emit(
                "download-progress",
                DownloadProgress {
                    status_message: "Conectando ao servidor".to_string(),
                    current_file: current_file + 1,
                    total_files,
                    file_name: file_name.clone(),
                    downloaded_bytes: 0,
                    total_bytes: 0,
                },
            )
            .map_err(|e| format!("Erro ao emitir evento: {}", e))?;

        // Baixar arquivo
        let response = get(&url).map_err(|_| "Erro ao conectar ao servidor")?;
        let total_bytes = response
            .content_length()
            .ok_or("Tamanho do arquivo desconhecido")?;
        let mut downloaded_bytes = 0;
        let mut file = fs::File::create(&destination)
            .map_err(|_| "Erro ao criar arquivo local")?;
        
        let mut reader = BufReader::new(response);
        let mut buffer = [0; 8192]; // Tamanho do buffer de 8KB

        loop {
            let bytes_read = reader.read(&mut buffer).map_err(|_| "Erro durante o download")?;
            if bytes_read == 0 {
                break; // Fim do arquivo
            }
            file.write_all(&buffer[..bytes_read]).map_err(|_| "Erro ao gravar no arquivo")?;
            downloaded_bytes += bytes_read as u64;

            // Emitir progresso
            app_handle
                .emit(
                    "download-progress",
                    DownloadProgress {
                        status_message: "Baixando arquivo".to_string(),
                        current_file: current_file + 1,
                        total_files,
                        file_name: file_name.clone(),
                        downloaded_bytes,
                        total_bytes,
                    },
                )
                .map_err(|e| format!("Erro ao emitir evento: {}", e))?;
        }
    }

    Ok(())
}

pub mod lua {
    use mlua::{Lua, Value};
    use super::DownloadProgress;

    pub fn parse_updates(content: &str) -> Result<Vec<DownloadProgress>, String> {
        let lua = Lua::new();
        let globals = lua.globals();

        lua.load(content).exec().map_err(|e| format!("Erro ao carregar Lua: {}", e))?;
        let updates: Value = globals.get("updates").map_err(|e| format!("Erro ao acessar tabela Lua: {}", e))?;

        if let Value::Table(table) = updates {
            let mut result = Vec::new();
            for pair in table.sequence_values::<mlua::Table>() {
                let table_item = pair.map_err(|_| "Erro ao iterar valores Lua")?;
                // Extrair o nome do arquivo da tabela Lua
                let file_name: String = table_item
                    .get("file_name")
                    .map_err(|_| "Erro ao obter 'file_name' da tabela Lua")?;
                
                let update = DownloadProgress {
                    status_message: "Download".to_string(),
                    current_file: 0,
                    total_files: 0,
                    file_name,
                    downloaded_bytes: 0,
                    total_bytes: 0,
                };
                result.push(update);
            }
            Ok(result)
        } else {
            Err("Estrutura inesperada em updates".to_string())
        }
    }
}

error[E0603]: macro import `__cmd__start_download` is private
  --> src\lib.rs:20:60
   |
20 |         .invoke_handler(tauri::generate_handler![download::start_download])
   |                                                            ^^^^^^^^^^^^^^ private macro import
   |
note: the macro import `__cmd__start_download` is defined here...
  --> src\download.rs:18:4
   |
18 | fn start_download(app_handle: tauri::AppHandle) -> Result<(), String> {
   |    ^^^^^^^^^^^^^^
note: ...and refers to the macro `__cmd__start_download` which is defined here
  --> src\download.rs:17:1
   |
17 | #[tauri::command]
   | ^^^^^^^^^^^^^^^^^
   = note: this error originates in the attribute macro `tauri::command` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0603`.
error: could not compile `RagnaTales` (lib) due to 1 previous error