Skip to content

Commit d4403a3

Browse files
committed
[Rust] Add BinaryViewExt::workflow
1 parent abc1562 commit d4403a3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rust/src/binary_view.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ pub mod memory_map;
6868
pub mod reader;
6969
pub mod writer;
7070

71+
use crate::workflow::Workflow;
7172
pub use memory_map::MemoryMap;
7273
pub use reader::BinaryReader;
7374
pub use writer::BinaryWriter;
@@ -324,6 +325,14 @@ pub trait BinaryViewExt: BinaryViewBase {
324325
unsafe { BNAbortAnalysis(self.as_ref().handle) }
325326
}
326327

328+
fn workflow(&self) -> Ref<Workflow> {
329+
unsafe {
330+
let raw_ptr = BNGetWorkflowForBinaryView(self.as_ref().handle);
331+
let nonnull = NonNull::new(raw_ptr).expect("All views must have a workflow");
332+
Workflow::ref_from_raw(nonnull)
333+
}
334+
}
335+
327336
fn analysis_info(&self) -> Result<AnalysisInfo> {
328337
let info_ref = unsafe { BNGetAnalysisInfo(self.as_ref().handle) };
329338
if info_ref.is_null() {

0 commit comments

Comments
 (0)