32 lines
560 B
Rust
32 lines
560 B
Rust
use super::config::Config;
|
|
use super::printer::*;
|
|
|
|
#[derive(Debug)]
|
|
pub struct FileMatch {
|
|
pub file_name: String,
|
|
pub matches: Vec<Match>,
|
|
}
|
|
|
|
impl FileMatch {
|
|
pub fn print(&self, config: &Config) {
|
|
let cp = ColorPrinter {
|
|
config,
|
|
file_match: self,
|
|
};
|
|
cp.print();
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Match {
|
|
pub line_number: usize,
|
|
pub match_indexes: Vec<MatchIndex>,
|
|
pub text: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct MatchIndex {
|
|
pub start: usize,
|
|
pub end: usize,
|
|
}
|