diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-07-08 13:29:37 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-07-08 13:29:37 +0200 |
| commit | ae8fad30cd9e76bcba9949095a2cafabb4f1ca8a (patch) | |
| tree | d578b5ee0e1a559f2ae31a5966277876d5334268 /src/filecache.rs | |
| parent | 9257e158cd76027f148138e7bc94e5bd8a2a5035 (diff) | |
add merge functionality
Diffstat (limited to 'src/filecache.rs')
| -rw-r--r-- | src/filecache.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/filecache.rs b/src/filecache.rs index f8d84ec..a352e58 100644 --- a/src/filecache.rs +++ b/src/filecache.rs @@ -1,10 +1,26 @@ +use std::hash::{Hasher, Hash}; + use crate::vector::FileVector; /// Represents one file which was indexed. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct FileCache { - pub vector : FileVector, 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); + } } impl FileCache { |