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::PathBuf;
use std::sync::Mutex;

#[derive(Clone, Debug)]
pub struct IndexerConfig {
    index_dir: PathBuf,      // Changed to private
    metadata_file: String,   // Changed to private
    batch_size: usize,       // Changed to private
    indexable_extensions: Vec<String>,
}

impl IndexerConfig {
    // Getters
    pub fn get_index_dir(&self) -> PathBuf {
        self.index_dir.clone()
    }

    pub fn get_metadata_file(&self) -> String {
        self.metadata_file.clone()
    }

    pub fn get_batch_size(&self) -> usize {
        self.batch_size
    }

    pub fn get_indexable_extensions(&self) -> Vec<String> {
        self.indexable_extensions.clone()
    }

    // Setters
    pub fn set_index_dir(&mut self, path: PathBuf) {
        self.index_dir = path;
    }

    pub fn set_metadata_file(&mut self, filename: String) {
        self.metadata_file = filename;
    }

    pub fn set_batch_size(&mut self, size: usize) {
        self.batch_size = size;
    }

    pub fn set_indexable_extensions(&mut self, extensions: Vec<String>) {
        self.indexable_extensions = extensions;
    }
}

impl Default for IndexerConfig {
    fn default() -> Self {
        Self {
            index_dir: PathBuf::from("C:\\Users\\yf4jm\\Desktop\\f\\index"),
            metadata_file: String::from("files_metadata.json"),
            batch_size: 250,
            indexable_extensions: vec!["txt".to_string(), "pdf".to_string()],
        }
    }
}

lazy_static::lazy_static! {
    pub static ref CONFIG: Mutex<IndexerConfig> = Mutex::new(IndexerConfig::default());
}

// Helper functions that work with the global config
pub fn get_config() -> IndexerConfig {
    CONFIG.lock().unwrap().clone()
}

pub fn set_config(new_config: IndexerConfig) {
    let mut config = CONFIG.lock().unwrap();
    *config = new_config;
}

// Replace the old getter functions with these
pub fn index_dir() -> PathBuf {
    CONFIG.lock().unwrap().get_index_dir()
}

pub fn metadata_file() -> String {
    CONFIG.lock().unwrap().get_metadata_file()
}

pub fn batch_size() -> usize {
    CONFIG.lock().unwrap().get_batch_size()
}

pub fn indexable_extensions() -> Vec<String> {
    CONFIG.lock().unwrap().get_indexable_extensions()
}