Organize code into separate files
This commit is contained in:
28
src/filematch.rs
Normal file
28
src/filematch.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
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 {};
|
||||
cp.print(&config, &self);
|
||||
}
|
||||
}
|
||||
|
||||
#[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,
|
||||
}
|
||||
Reference in New Issue
Block a user