Crate xerg

Crate xerg 

Source
Expand description

§Xerg - A High-Performance Rust Grep Implementation

Xerg is an ultra-fast, parallel grep implementation written in Rust that searches for patterns in files and directories with syntax highlighting and detailed search statistics.

§Features

  • Parallel Processing: Multi-core file processing with intelligent thread pool management
  • Pattern Matching: Regular expression engine with optimized performance
  • Structured Streaming: Organized results with comprehensive statistics and timing
  • Directory Traversal: Recursive scanning with symlink support
  • Colorized Output: Customizable syntax highlighting (red, green, blue, bold)
  • Search Statistics: Structured result format with timing metrics using --stats

§Usage

use xerg::{run, output::colors::Color};
use std::path::PathBuf;

let dir = PathBuf::from(".");
let pattern = "use";
let color = Color::Blue;
let show_stats = true;

run(&dir, pattern, &color, show_stats);

§Architecture

The library is organized into several focused modules:

  • [colors]: ANSI color management and formatting
  • [crawler]: Directory traversal with symlink support
  • [highlighter]: Regex-based text highlighting
  • [result]: Message handling and statistics result formatting
  • search: Formatted parallel file processing (use –formatted flag)
  • [search_xtreme]: Ultra-fast raw output mode for maximum speed (default)

Modules§

output
Output formatting and presentation modules
search
Search functionality and related modules

Functions§

run
Run xerg in default mode with formatted output
run_xtreme
Run xerg in xtreme mode for maximum performance