Skip to content

Commit 8e10936

Browse files
committed
[Rust] Impl PartialEq, Eq and Hash for ProjectFile
1 parent 92faa86 commit 8e10936

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

rust/src/project/file.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use binaryninjacore_sys::{
1111
BNProjectFileSetFolder, BNProjectFileSetName,
1212
};
1313
use std::fmt::Debug;
14+
use std::hash::Hash;
1415
use std::path::{Path, PathBuf};
1516
use std::ptr::{null_mut, NonNull};
1617
use std::time::SystemTime;
@@ -155,6 +156,20 @@ impl Debug for ProjectFile {
155156
unsafe impl Send for ProjectFile {}
156157
unsafe impl Sync for ProjectFile {}
157158

159+
impl PartialEq for ProjectFile {
160+
fn eq(&self, other: &Self) -> bool {
161+
self.id() == other.id()
162+
}
163+
}
164+
165+
impl Eq for ProjectFile {}
166+
167+
impl Hash for ProjectFile {
168+
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
169+
self.id().hash(state);
170+
}
171+
}
172+
158173
impl ToOwned for ProjectFile {
159174
type Owned = Ref<Self>;
160175

0 commit comments

Comments
 (0)