aboutsummaryrefslogtreecommitdiff
path: root/src/filecache.rs
blob: 721d7a4247e9fd7ddd449d8e24b8920f1f590a68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::hash::{Hasher, Hash};
use serde::{Deserialize, Serialize};
use crate::vector::FileVector;

/// Represents one file which was indexed.
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
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<H: Hasher>(&self, state: &mut H) {
        self.path.hash(state);
    }
}