tauri-plugin-indexer 0.1.1

a custom indexer (if the version is 1.0.0 then the plugin is ready)
Documentation
use std::path::{Path, PathBuf};
use tauri::{AppHandle, command, Runtime};

use crate::models::*;
use crate::Result;
use crate::IndexerExt;
use crate::indexer::indexer::index;

#[command]
pub(crate) async fn ping<R: Runtime>(
    app: AppHandle<R>,
    payload: PingRequest,
) -> Result<PingResponse> {
    app.indexer().ping(payload)
}

#[command]
pub(crate) async fn index_directory(path: String) -> Result<()> {
    match index::index_directory(PathBuf::from(path)) {
        Ok(_) => Ok(()),
        Err(e) => {
            eprintln!("Error indexing directory: {}", e);
            // Convert anyhow::Error to std::io::Error
            Err(std::io::Error::new(
                std::io::ErrorKind::Other,
                e.to_string()
            ).into())
        }
    }
}