Skip to main content

process_batch_with_page_progress

Function process_batch_with_page_progress 

Source
pub fn process_batch_with_page_progress<P, F, T>(
    paths: &[P],
    config: BatchConfig,
    on_page_progress: Box<dyn Fn(usize, usize) + Send + Sync + 'static>,
    processor: F,
) -> BatchResult<T>
where P: AsRef<Path>, F: Fn(&PdfDocument) -> Result<T> + Send + Sync + 'static, T: Send + 'static,
Expand description

process_batch with a per-page progress callback, invoked as (done, total) with the current file’s page counts: a three-page file reports (1, 3) through (3, 3) once it has been read. It fires only for files that open and process successfully, from the worker thread; with several workers the files interleave. The per-file callback in BatchConfig::on_progress still fires as before.

A separate function rather than a BatchConfig field: BatchConfig is built with struct literals, so a new public field would break every such literal written against 1.0.