From 34e93635fd0df131f92f0dcaa8a061648148e40d Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sat, 21 Mar 2026 21:12:43 -0700 Subject: [Rust] Impl `PartialEq`, `Eq` and `Hash` for `ProjectFile` --- rust/src/project/file.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'rust') diff --git a/rust/src/project/file.rs b/rust/src/project/file.rs index c3114cd3..22bf9b4b 100644 --- a/rust/src/project/file.rs +++ b/rust/src/project/file.rs @@ -11,6 +11,7 @@ use binaryninjacore_sys::{ BNProjectFileSetFolder, BNProjectFileSetName, }; use std::fmt::Debug; +use std::hash::Hash; use std::path::{Path, PathBuf}; use std::ptr::{null_mut, NonNull}; use std::time::SystemTime; @@ -155,6 +156,20 @@ impl Debug for ProjectFile { unsafe impl Send for ProjectFile {} unsafe impl Sync for ProjectFile {} +impl PartialEq for ProjectFile { + fn eq(&self, other: &Self) -> bool { + self.id() == other.id() + } +} + +impl Eq for ProjectFile {} + +impl Hash for ProjectFile { + fn hash(&self, state: &mut H) { + self.id().hash(state); + } +} + impl ToOwned for ProjectFile { type Owned = Ref; -- cgit v1.3.1