mezzaluna_loaded_features/feature/
disk.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use core::hash::{Hash, Hasher};
use std::path::{Path, PathBuf};

use same_file::Handle;

#[derive(Debug)]
pub struct Feature {
    handle: Handle,
    path: PathBuf,
}

impl Feature {
    pub fn with_handle_and_path(handle: Handle, path: PathBuf) -> Self {
        Self { handle, path }
    }

    pub fn path(&self) -> &Path {
        &self.path
    }
}

impl Hash for Feature {
    fn hash<H: Hasher>(&self, state: &mut H) {
        self.handle.hash(state);
    }
}

impl PartialEq for Feature {
    fn eq(&self, other: &Self) -> bool {
        self.handle == other.handle
    }
}

impl Eq for Feature {}