use super::cached_path::CachedPath;
use papaya::Equivalent;
use std::{
hash::{Hash, Hasher},
path::Path,
};
#[derive(Debug)]
pub struct BorrowedCachedPath<'a> {
pub hash: u64,
pub path: &'a Path,
}
impl Equivalent<CachedPath> for BorrowedCachedPath<'_> {
fn equivalent(&self, other: &CachedPath) -> bool {
self.path.as_os_str() == other.path().as_os_str()
}
}
impl Hash for BorrowedCachedPath<'_> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.hash.hash(state);
}
}
impl PartialEq for BorrowedCachedPath<'_> {
fn eq(&self, other: &Self) -> bool {
self.path.as_os_str() == other.path.as_os_str()
}
}