From e34ddc02cb073d762931c2ea5217e7489ef6c4c2 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sat, 19 Oct 2024 19:02:06 -0400 Subject: Rework rust workflow api and add workflow example --- rust/src/function.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'rust/src/function.rs') 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, @@ -163,6 +165,13 @@ impl Function { } } + pub fn workflow(&self) -> Option> { + unsafe { + let workflow = NonNull::new(BNGetWorkflowForFunction(self.handle))?; + Some(Workflow::ref_from_raw(workflow)) + } + } + pub fn start(&self) -> u64 { unsafe { BNGetFunctionStart(self.handle) } } -- cgit v1.3.1