Crate xerg

Crate xerg 

Source
Expand description

§XGrep - A High-Performance Rust Grep Implementation

XGrep is a 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, 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§

colors
Color Management
crawler
Directory Traversal
highlighter
Text Highlighting
result
Search Results Management
search
Parallel File Search
search_xtreme
Xtreme Search Mode

Functions§

run
run_xtreme