diff options
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/section.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/rust/src/section.rs b/rust/src/section.rs index 77e40232..edf19582 100644 --- a/rust/src/section.rs +++ b/rust/src/section.rs @@ -15,6 +15,7 @@ //! Sections are [crate::segment::Segment]s that are loaded into memory at run time use std::fmt; +use std::hash::{Hash, Hasher}; use std::ops::Range; use binaryninjacore_sys::*; @@ -61,7 +62,6 @@ impl From<Semantics> for BNSectionSemantics { } } -#[derive(PartialEq, Eq, Hash)] pub struct Section { handle: *mut BNSection, } @@ -161,6 +161,30 @@ impl fmt::Debug for Section { } } +impl PartialEq for Section { + fn eq(&self, other: &Self) -> bool { + // TODO: Do we want to make this complete match like this? + self.name() == other.name() + && self.address_range() == other.address_range() + && self.semantics() == other.semantics() + && self.linked_section() == other.linked_section() + && self.info_section() == other.info_section() + && self.info_data() == other.info_data() + && self.align() == other.align() + && self.entry_size() == other.entry_size() + && self.auto_defined() == other.auto_defined() + } +} + +impl Eq for Section {} + +impl Hash for Section { + fn hash<H: Hasher>(&self, state: &mut H) { + self.name().hash(state); + self.address_range().hash(state); + } +} + impl ToOwned for Section { type Owned = Ref<Self>; |
