Skip to content

Commit a86862e

Browse files
committed
[Rust] Add Symbol::ordinal
1 parent 10eb2df commit a86862e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

rust/src/symbol.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,16 @@ impl Symbol {
267267
unsafe { BNGetSymbolAddress(self.handle) }
268268
}
269269

270+
/// Get the symbols ordinal, this will return `None` if the symbol ordinal is `0`.
271+
pub fn ordinal(&self) -> Option<u64> {
272+
let ordinal = unsafe { BNGetSymbolOrdinal(self.handle) };
273+
if ordinal == u64::MIN {
274+
None
275+
} else {
276+
Some(ordinal)
277+
}
278+
}
279+
270280
pub fn auto_defined(&self) -> bool {
271281
unsafe { BNIsSymbolAutoDefined(self.handle) }
272282
}

0 commit comments

Comments
 (0)