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

/// Represents one file which was indexed.
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
        }
    }
}