Tenho seguinte código rust tauri v2

import { useEffect, useState } from 'react';
import { invoke } from '@tauri-apps/api/core';
import { listen } from '@tauri-apps/api/event';

interface DownloadProgress {
  currentFile: number;
  totalFiles: number;
  fileName: string;
  downloadedBytes: number;
  totalBytes: number;
}

function formatBytes(bytes: number) {
  if (bytes === 0) return '0 B';
  const k = 1024;
  const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
  const i = Math.floor(Math.log(bytes) / Math.log(k));
  const value = bytes / Math.pow(k, i);
  return `${value.toFixed(2)} ${units[i]}`;
}

function DownloadManager() {
  const [message, setMessage] = useState('');
  const [progress, setProgress] = useState<DownloadProgress>({
    currentFile: 0,
    totalFiles: 0,
    fileName: '',
    downloadedBytes: 0,
    totalBytes: 0,
  });
  const [isDownloading, setIsDownloading] = useState(false);

  useEffect(() => {
    const setupListener = async () => {
      const unlisten = await listen('download-message', (e) => {
        if (typeof e.payload === 'string') {
          switch (e.payload) {
            case 'ConnectingToServer':
              setMessage('Conectando ao servidor...');
              break;
            case 'ValidatingFileUrl':
              setMessage('Validando URL do arquivo...');
              break;
            case 'AuthenticatingWithServer':
              setMessage('Autenticando com o servidor...');
              break;
            case 'VerifyingFileIntegrity':
              setMessage('Verificando integridade do arquivo...');
              break;
            case 'ErrorNotFound':
              setMessage('Erro: Arquivo não encontrado (404)');
              setIsDownloading(false);
              break;
            case 'ErrorAccessDenied':
              setMessage('Erro: Acesso negado (403)');
              setIsDownloading(false);
              break;
            case 'ErrorServerUnavailable':
              setMessage('Erro: Servidor indisponível (503)');
              setIsDownloading(false);
              break;
            case 'RestartingDownload':
              setMessage('Reiniciando download após falha...');
              break;
            case 'FileAlreadyExists':
              setMessage('Arquivo já existe...');
              break;
            case 'PreparingDownload':
              setMessage('Preparando download...');
              setIsDownloading(true);
              break;
          }
        } else if (typeof e.payload === 'object' && e.payload !== null) {
          const progressData = e.payload as Partial<DownloadProgress>;
          setProgress((prevProgress) => ({
            ...prevProgress,
            currentFile: progressData.currentFile ?? prevProgress.currentFile,
            totalFiles: progressData.totalFiles ?? prevProgress.totalFiles,
            fileName: progressData.fileName ?? prevProgress.fileName,
            downloadedBytes: progressData.downloadedBytes ?? prevProgress.downloadedBytes,
            totalBytes: progressData.totalBytes ?? prevProgress.totalBytes,
          }));
          setMessage(`Baixando arquivo (${progressData.currentFile} / ${progressData.totalFiles}): ${progressData.fileName} (${formatBytes(progressData.downloadedBytes)} / ${formatBytes(progressData.totalBytes)})`);
        }
      });

      return () => {
        unlisten();
      };
    };

    setupListener();
  }, []);

  const startDownload = async () => {
    if (!isDownloading) {
      setIsDownloading(true);
      await invoke('download_files');
    }
  };

  const pauseDownload = async () => {
    setMessage('Download pausado.');
    setIsDownloading(false);
    await invoke('pause_download');
  };

  const resumeDownload = async () => {
    setMessage('Resumindo download...');
    setIsDownloading(true);
    await invoke('resume_download');
  };

  const progressPercent = progress.totalBytes > 0 
    ? Math.min((progress.downloadedBytes / progress.totalBytes) * 100, 100)
    : 0;

  return (
    <div className="app-container">
      <h1>Gerenciador de Downloads</h1>
      <button onClick={startDownload} disabled={isDownloading}>
        Iniciar Download
      </button>
      {isDownloading && (
        <>
          <button onClick={pauseDownload} style={{ marginLeft: '10px' }}>
            Pausar
          </button>
          <button onClick={resumeDownload} style={{ marginLeft: '10px' }}>
            Retomar
          </button>
        </>
      )}
      <div className="absolute bottom-3 rounded-lg w-[71%] h-[8%] flex flex-col justify-between items-center">
        <p className="text-[14px] font-bold text-opacity-[0.95] text-white text-center">
          {message}
        </p>
        <div className="w-[95%] bg-[#0E1622]/[0.95] rounded-md h-5 flex items-center">
          <div
            className="bg-[#1164CA]/[0.95] ml-1 rounded-md h-4 transition-all duration-300"
            style={{ width: `${progressPercent}%` }}
          />
        </div>
      </div>
    </div>
  );
}

export default DownloadManager;

pub fn run() {
    tauri::Builder::default()
        .plugin(tauri_plugin_shell::init())
        .invoke_handler(tauri::generate_handler![
            download::download_files,
            download::pause_download,
            download::resume_download
        ])
        .run(tauri::generate_context!())
        .expect("error while running application");
}


No react tenho o código

import { useEffect, useState } from 'react';
import { invoke } from '@tauri-apps/api/core';
import { listen } from '@tauri-apps/api/event';

interface DownloadProgress {
  currentFile: number;
  totalFiles: number;
  fileName: string;
  downloadedBytes: number;
  totalBytes: number;
}

function formatBytes(bytes: number) {
  if (bytes === 0) return '0 B';
  const k = 1024;
  const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
  const i = Math.floor(Math.log(bytes) / Math.log(k));
  const value = bytes / Math.pow(k, i);
  return `${value.toFixed(2)} ${units[i]}`;
}

function DownloadManager() {
  const [message, setMessage] = useState('');
  const [progress, setProgress] = useState<DownloadProgress>({
    currentFile: 0,
    totalFiles: 0,
    fileName: '',
    downloadedBytes: 0,
    totalBytes: 0,
  });
  const [isDownloading, setIsDownloading] = useState(false);

  useEffect(() => {
    const setupListener = async () => {
      const unlisten = await listen('download-message', (e) => {
        if (typeof e.payload === 'string') {
          switch (e.payload) {
            case 'ConnectingToServer':
              setMessage('Conectando ao servidor...');
              break;
            case 'ValidatingFileUrl':
              setMessage('Validando URL do arquivo...');
              break;
            case 'AuthenticatingWithServer':
              setMessage('Autenticando com o servidor...');
              break;
            case 'VerifyingFileIntegrity':
              setMessage('Verificando integridade do arquivo...');
              break;
            case 'ErrorNotFound':
              setMessage('Erro: Arquivo não encontrado (404)');
              setIsDownloading(false);
              break;
            case 'ErrorAccessDenied':
              setMessage('Erro: Acesso negado (403)');
              setIsDownloading(false);
              break;
            case 'ErrorServerUnavailable':
              setMessage('Erro: Servidor indisponível (503)');
              setIsDownloading(false);
              break;
            case 'RestartingDownload':
              setMessage('Reiniciando download após falha...');
              break;
            case 'FileAlreadyExists':
              setMessage('Arquivo já existe...');
              break;
            case 'PreparingDownload':
              setMessage('Preparando download...');
              setIsDownloading(true);
              break;
          }
        } else if (typeof e.payload === 'object' && e.payload !== null) {
          const progressData = e.payload as Partial<DownloadProgress>;
          setProgress((prevProgress) => ({
            ...prevProgress,
            currentFile: progressData.currentFile ?? prevProgress.currentFile,
            totalFiles: progressData.totalFiles ?? prevProgress.totalFiles,
            fileName: progressData.fileName ?? prevProgress.fileName,
            downloadedBytes: progressData.downloadedBytes ?? prevProgress.downloadedBytes,
            totalBytes: progressData.totalBytes ?? prevProgress.totalBytes,
          }));
          setMessage(`Baixando arquivo (${progressData.currentFile} / ${progressData.totalFiles}): ${progressData.fileName} (${formatBytes(progressData.downloadedBytes)} / ${formatBytes(progressData.totalBytes)})`);
        }
      });

      return () => {
        unlisten();
      };
    };

    setupListener();
  }, []);

  const startDownload = async () => {
    if (!isDownloading) {
      setIsDownloading(true);
      await invoke('download_files');
    }
  };

  const pauseDownload = async () => {
    setMessage('Download pausado.');
    setIsDownloading(false);
    await invoke('pause_download');
  };

  const resumeDownload = async () => {
    setMessage('Resumindo download...');
    setIsDownloading(true);
    await invoke('resume_download');
  };

  const progressPercent = progress.totalBytes > 0 
    ? Math.min((progress.downloadedBytes / progress.totalBytes) * 100, 100)
    : 0;

  return (
    <div className="app-container">
      <h1>Gerenciador de Downloads</h1>
      <button onClick={startDownload} disabled={isDownloading}>
        Iniciar Download
      </button>
      {isDownloading && (
        <>
          <button onClick={pauseDownload} style={{ marginLeft: '10px' }}>
            Pausar
          </button>
          <button onClick={resumeDownload} style={{ marginLeft: '10px' }}>
            Retomar
          </button>
        </>
      )}
      <div className="absolute bottom-3 rounded-lg w-[71%] h-[8%] flex flex-col justify-between items-center">
        <p className="text-[14px] font-bold text-opacity-[0.95] text-white text-center">
          {message}
        </p>
        <div className="w-[95%] bg-[#0E1622]/[0.95] rounded-md h-5 flex items-center">
          <div
            className="bg-[#1164CA]/[0.95] ml-1 rounded-md h-4 transition-all duration-300"
            style={{ width: `${progressPercent}%` }}
          />
        </div>
      </div>
    </div>
  );
}

export default DownloadManager;

Quando vou compilar recebo o erro

error: future cannot be sent between threads safely
   --> src\download.rs:76:1
    |
76  |   #[tauri::command]
    |   ^^^^^^^^^^^^^^^^^ future returned by `download_files` is not `Send`
    |
   ::: src\lib.rs:20:25
    |
20  |           .invoke_handler(tauri::generate_handler![
    |  _________________________-
21  | |             download::download_files,
22  | |             download::pause_download,
23  | |             download::resume_download
24  | |         ])
    | |_________- in this macro invocation
    |
    = help: within `impl futures_util::Future<Output = Result<(), std::string::String>>`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, DownloadState>`, which is required by `impl futures_util::Future<Output = Result<(), std::string::String>>: std::marker::Send`
note: future is not `Send` as this value is used across an await
   --> src\download.rs:96:57
    |
96  |         download_state.lock().unwrap().wait_if_paused().await;
    |         ------------------------------                  ^^^^^ await occurs here, with `download_state.lock().unwrap()` maybe used later
    |         |
    |         has type `std::sync::MutexGuard<'_, DownloadState>` which is not `Send`
note: required by a bound in `ResultFutureTag::future`
   --> C:\Users\jonatas\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tauri-2.0.6\src\ipc\command.rs:331:42
    |
324 |     pub fn future<T, E, F>(
    |            ------ required by a bound in this associated function
...
331 |       F: Future<Output = Result<T, E>> + Send,
    |                                          ^^^^ required by this bound in `ResultFutureTag::future`
    = note: this error originates in the macro `download::__cmd__download_files` which comes from the expansion of the macro `tauri::generate_handler` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `RagnaTales` (lib) due to 2 previous errors