aboutsummaryrefslogtreecommitdiff
path: root/src/filecache.rs
blob: f8d84ecbfbb86dd5353a4eae6737ce1fde425771 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::vector::FileVector;

/// Represents one file which was indexed.
#[derive(Clone, Debug)]
pub struct FileCache {
    pub vector : FileVector,
    pub path : String,
}

impl FileCache {
    pub fn from_line(line : String) -> Self {
        let ls : Vec<String> = line.split(',').map(|s| s.to_string()).collect();
        let v = FileVector::from_string(ls[1].clone());
        let p = ls[0].clone().replace('\0', ",");
        Self {
            vector : v,
            path : p
        }
    }
}