rusty-pdfgrep 0.1.0

Grep through PDF files — a Rust port of Hans-Peter Deifel's `pdfgrep(1)` with lopdf-backed text extraction, regex + fancy-regex pluggable engines, --password retry for encrypted PDFs, GNU-grep-compatible color output, recursive walking with fnmatch include/exclude, and a typed library API.
Documentation
//! Public error type for the rusty-pdfgrep library API (FR-041).

use std::path::PathBuf;

/// Error type returned by [`PdfGrep`](crate::PdfGrep) operations.
///
/// `#[non_exhaustive]` allows additive variants in SemVer-minor releases.
/// Downstream code MUST use a wildcard `_` arm when matching.
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum PdfGrepError {
    /// I/O failure for a specific path.
    #[error("rusty-pdfgrep: {path}: {source}")]
    Io {
        /// Path being operated on when the error occurred.
        path: PathBuf,
        /// Underlying `std::io::Error`.
        #[source]
        source: std::io::Error,
    },

    /// PDF parser error from `lopdf`.
    #[error("rusty-pdfgrep: {path}: PDF parse error: {message}")]
    Pdf {
        /// Path of the PDF that failed to parse.
        path: PathBuf,
        /// Human-readable explanation from the parser.
        message: String,
    },

    /// PDF is encrypted and no `--password` succeeded.
    #[error("rusty-pdfgrep: {path}: encrypted; skipping")]
    Encrypted {
        /// Path of the encrypted PDF.
        path: PathBuf,
    },

    /// Regex compilation failed (invalid pattern).
    #[error("rusty-pdfgrep: invalid regex '{pattern}': {message}")]
    RegexCompile {
        /// The offending pattern string.
        pattern: String,
        /// Compiler diagnostic.
        message: String,
    },

    /// Invalid page-range value (e.g., reverse range or non-numeric).
    #[error("rusty-pdfgrep: invalid page range '{value}'")]
    PageRange {
        /// The offending input value.
        value: String,
    },
}