Skip to content

Commit f0d2ece

Browse files
committed
[Rust] Impl PartialEq, Eq and Hash for Project
1 parent 8e10936 commit f0d2ece

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

rust/src/project.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ pub mod folder;
33

44
use std::ffi::c_void;
55
use std::fmt::Debug;
6-
use std::path::Path;
6+
use std::hash::Hash;
7+
use std::path::{Path, PathBuf};
78
use std::ptr::{null_mut, NonNull};
89
use std::time::{Duration, SystemTime, UNIX_EPOCH};
910

@@ -636,6 +637,20 @@ impl Debug for Project {
636637
}
637638
}
638639

640+
impl PartialEq for Project {
641+
fn eq(&self, other: &Self) -> bool {
642+
self.id() == other.id()
643+
}
644+
}
645+
646+
impl Eq for Project {}
647+
648+
impl Hash for Project {
649+
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
650+
self.id().hash(state);
651+
}
652+
}
653+
639654
impl ToOwned for Project {
640655
type Owned = Ref<Self>;
641656

0 commit comments

Comments
 (0)