use std::hash::{Hasher, Hash}; use crate::vector::FileVector; /// Represents one file which was indexed. #[derive(Clone, Debug, Default)] pub struct FileCache { pub path : String, pub vector : FileVector, } impl PartialEq for FileCache { fn eq(&self, other : &Self) -> bool { self.path == other.path } } impl Eq for FileCache { } impl Hash for FileCache { fn hash(&self, state: &mut H) { self.path.hash(state); } } impl FileCache { pub fn from_line(line : String) -> Self { let ls : Vec = line.split(',').map(|s| s.to_string()).collect(); let v = FileVector::from_string(&ls[1]); let p = ls[0].clone().replace('\0', ","); Self { vector : v, path : p } } }