summaryrefslogtreecommitdiff
path: root/rust/src/function.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-10-19 19:02:06 -0400
committerMason Reed <mason@vector35.com>2024-10-19 19:03:26 -0400
commite34ddc02cb073d762931c2ea5217e7489ef6c4c2 (patch)
treeeef618583a2764b8f9044acbc38a0e7ab829adf5 /rust/src/function.rs
parent3a947674819c43e8de9902242a1b1748943bb025 (diff)
Rework rust workflow api and add workflow example
Diffstat (limited to 'rust/src/function.rs')
-rw-r--r--rust/src/function.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs
index 8b38ec54..01b086f2 100644
--- a/rust/src/function.rs
+++ b/rust/src/function.rs
@@ -42,6 +42,8 @@ pub use binaryninjacore_sys::BNFunctionUpdateType as FunctionUpdateType;
use std::{fmt, mem};
use std::{ffi::c_char, hash::Hash, ops::Range};
+use std::ptr::NonNull;
+use crate::workflow::Workflow;
pub struct Location {
pub arch: Option<CoreArchitecture>,
@@ -163,6 +165,13 @@ impl Function {
}
}
+ pub fn workflow(&self) -> Option<Ref<Workflow>> {
+ unsafe {
+ let workflow = NonNull::new(BNGetWorkflowForFunction(self.handle))?;
+ Some(Workflow::ref_from_raw(workflow))
+ }
+ }
+
pub fn start(&self) -> u64 {
unsafe { BNGetFunctionStart(self.handle) }
}