summaryrefslogtreecommitdiff
path: root/rust/src/symbol.rs
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2023-02-14 00:09:13 -0500
committerKyleMiles <krm504@nyu.edu>2023-02-14 00:15:57 -0500
commit9e91eaf63aed340a2c0a61ad8f70e9a7883e3aba (patch)
treea77dc4618b1f2848b09694a4fb81b4fa193a1566 /rust/src/symbol.rs
parent60f49f32d989355696b1eb78aee98140f417952c (diff)
Rust API: Misc changes and improvements
Diffstat (limited to 'rust/src/symbol.rs')
-rw-r--r--rust/src/symbol.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/rust/src/symbol.rs b/rust/src/symbol.rs
index 22c2b051..59080814 100644
--- a/rust/src/symbol.rs
+++ b/rust/src/symbol.rs
@@ -166,7 +166,7 @@ impl<S: BnStrCompatible> SymbolBuilder<S> {
self.ordinal,
);
- Ref::new(Symbol::from_raw(res))
+ Symbol::ref_from_raw(res)
}
}
}
@@ -177,6 +177,10 @@ pub struct Symbol {
}
impl Symbol {
+ pub(crate) unsafe fn ref_from_raw(raw: *mut BNSymbol) -> Ref<Self> {
+ Ref::new(Self { handle: raw })
+ }
+
pub(crate) unsafe fn from_raw(raw: *mut BNSymbol) -> Self {
Self { handle: raw }
}
@@ -226,6 +230,11 @@ impl Symbol {
pub fn auto_defined(&self) -> bool {
unsafe { BNIsSymbolAutoDefined(self.handle) }
}
+
+ /// Wether this symbol has external linkage
+ pub fn external(&self) -> bool {
+ self.binding() == Binding::Weak || self.binding() == Binding::Global
+ }
}
unsafe impl Send for Symbol {}