diff options
| author | KyleMiles <krm504@nyu.edu> | 2021-02-10 22:02:50 +0000 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2021-03-17 23:43:59 +0000 |
| commit | 1515df8e71412787470b27d04ed9b2944fca0fdc (patch) | |
| tree | 400fbc792da7de1cc62e0fae171aae2bdf346869 /rust/src/symbol.rs | |
| parent | 41e11f8387ebb3275da31994b85a7a8b6256eb99 (diff) | |
Misc typo changes, const changes, code cleanup, and example updates
Diffstat (limited to 'rust/src/symbol.rs')
| -rw-r--r-- | rust/src/symbol.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/rust/src/symbol.rs b/rust/src/symbol.rs index 2b3aa463..c545d962 100644 --- a/rust/src/symbol.rs +++ b/rust/src/symbol.rs @@ -13,6 +13,7 @@ // limitations under the License. use std::fmt; +use std::hash::{Hash, Hasher}; use std::ptr; use crate::rc::*; @@ -165,9 +166,6 @@ pub struct Symbol { pub(crate) handle: *mut BNSymbol, } -unsafe impl Send for Symbol {} -unsafe impl Sync for Symbol {} - impl Symbol { pub(crate) unsafe fn from_raw(raw: *mut BNSymbol) -> Self { Self { handle: raw } @@ -223,6 +221,9 @@ impl Symbol { } } +unsafe impl Send for Symbol {} +unsafe impl Sync for Symbol {} + impl fmt::Debug for Symbol { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( @@ -272,3 +273,16 @@ unsafe impl<'a> CoreOwnedArrayWrapper<'a> for Symbol { Guard::new(Symbol::from_raw(*raw), context) } } + +impl PartialEq for Ref<Symbol> { + fn eq(&self, other: &Self) -> bool { + **self == **other + } +} +impl Eq for Ref<Symbol> {} + +impl Hash for Ref<Symbol> { + fn hash<H: Hasher>(&self, state: &mut H) { + (**self).hash(state); + } +} |
