sift-core 0.2.0

Indexed regex search over codebases (library + grep-like CLI)
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::Candidate;

pub const ANSI_RESET: &[u8] = b"\x1b[0m";
pub const ANSI_PATH: &[u8] = b"\x1b[35m\x1b[1m";
pub const ANSI_LINE: &[u8] = b"\x1b[32m";

pub fn sum_candidate_file_bytes(candidates: &[Candidate]) -> u64 {
    candidates.iter().fold(0u64, |acc, c| {
        acc + std::fs::metadata(c.abs_path()).map_or(0, |m| m.len())
    })
}