sift_core/search/emit/format.rs
1use crate::Candidate;
2
3pub const ANSI_RESET: &[u8] = b"\x1b[0m";
4pub const ANSI_PATH: &[u8] = b"\x1b[35m\x1b[1m";
5pub const ANSI_LINE: &[u8] = b"\x1b[32m";
6
7impl Candidate {
8 /// Sum on-disk byte sizes for all candidates (used for search stats).
9 #[must_use]
10 pub fn total_file_bytes(candidates: &[Self]) -> u64 {
11 candidates.iter().fold(0u64, |acc, c| {
12 acc + std::fs::metadata(c.abs_path()).map_or(0, |m| m.len())
13 })
14 }
15}