daggrs 0.1.1

A fast Double-Array Aho-Corasick implementation for multi-pattern matching
Documentation
/// Metadata for a pattern stored in the automaton.
#[derive(Debug, Clone, Copy)]
pub struct Output {
    /// The pattern's unique identifier.
    pub pattern_id: u32,
    /// Length of the pattern in bytes.
    pub length: u32,
    /// Index of the parent output for suffix chaining (u32::MAX = none).
    pub parent: u32,
}

/// A match found during pattern searching.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Match {
    /// The matched pattern's identifier.
    pub pattern_id: u32,
    /// The starting byte index of the match (inclusive).
    pub start: usize,
    /// The ending byte index of the match (exclusive).
    pub end: usize,
}

/// Specifies how matches are reported when multiple patterns overlap.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum MatchKind {
    /// Report all overlapping matches at every position.
    #[default]
    Overlapping,
    /// Report only the first-added pattern at each position.
    /// Patterns added earlier take priority over later ones.
    LeftmostFirst,
    /// Report only the longest pattern at each position.
    LeftmostLongest,
    /// WordPiece tokenization mode with custom failure links.
    /// Failure links from complete tokens point to the continuation anchor (e.g., "##" state).
    WordPiece,
}