fn cache_dir() -> PathBuf {
    if let Ok(path) = std::env::var("TOKENIZERS_CACHE") {
        PathBuf::from(path)
    } else {
        let mut dir = dirs::cache_dir().unwrap_or_else(std::env::temp_dir);
        dir.push("huggingface");
        dir.push("tokenizers");
        dir
    }
}
/// Returns a directory to be used as cache.
///
/// If the `TOKENIZERS_CACHE` environment variable is set, we just return it. It is the
/// responsibility of the user to make sure this path is correct.
///
/// Otherwise, we try to use the default cache directory as defined for each OS:
///     - macOS: `/Users/{user}/Library/Caches/huggingface/tokenizers`
///     - linux: `/home/{user}/.cache/huggingface/tokenizers`
///     - windows: `C:\Users\{user}\AppData\Local\huggingface\tokenizers`
/// If the default cache directory cannot be found (if the user HOME folder is not defined),
/// then we fall back on a temporary directory
Returns a directory to be used as cache.
If the `TOKENIZERS_CACHE` environment variable is set, we just return it. It is the
responsibility of the user to make sure this path is correct.


Returns a directory to be used as cache . If the ` TOKENIZERS_CACHE ` environment variable is set we just return it . It is the responsibility of the user to make sure this path is correct .
fn cache_dir() -> PathBuf {
    if let Ok(path) = std::env::var("TOKENIZERS_CACHE") {
        PathBuf::from(path)
    } else {
        let mut dir = dirs::cache_dir().unwrap_or_else(std::env::temp_dir);
        dir.push("huggingface");
        dir.push("tokenizers");
        dir
    }
}
fn cache_dir ( ) -> PathBuf { if let Ok ( path ) = std :: env :: var ( " " ) { PathBuf :: from ( path ) } else { let mut dir = dirs :: cache_dir ( ) . unwrap_or_else ( std :: env :: temp_dir ) ; dir . push ( " " ) ; dir . push ( " " ) ; dir } }
Returns a directory to be used as cache.
Returns a directory to be used as cache .