xberg 1.0.9

High-performance document intelligence library for Rust. Extract text, metadata, and structured data from PDFs, Office documents, images, and 101 formats and 371 programming languages via tree-sitter code intelligence with async/sync APIs.
Documentation
//! Thread-local PDF file path for oxide text extraction.
//!
//! The current PDF file path is communicated via a thread-local to avoid
//! threading it through every function signature in the extraction pipeline.

use std::cell::RefCell;
use std::path::PathBuf;

thread_local! {
    static CURRENT_PDF_PATH: RefCell<Option<PathBuf>> = const { RefCell::new(None) };
}

/// Set the current PDF file path for oxide text extraction.
/// Call this before entering the markdown pipeline.
pub(crate) fn set_current_pdf_path(path: Option<PathBuf>) {
    CURRENT_PDF_PATH.with(|cell| {
        *cell.borrow_mut() = path;
    });
}