From 9e91eaf63aed340a2c0a61ad8f70e9a7883e3aba Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Tue, 14 Feb 2023 00:09:13 -0500 Subject: Rust API: Misc changes and improvements --- rust/src/symbol.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'rust/src/symbol.rs') 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 SymbolBuilder { 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 { + 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 {} -- cgit v1.3.1