diff options
| author | KyleMiles <krm504@nyu.edu> | 2021-05-03 18:45:19 -0400 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2021-05-11 16:49:24 -0400 |
| commit | eb7a52bf4bd3b19c22f2eadda444ab045c674fe3 (patch) | |
| tree | 2395d577d410908b5d0291682660dac2017c7e97 /rust/src/function.rs | |
| parent | 5731e612900bed0d542421e00e64324dbac9367e (diff) | |
Rust API : Better headless support; Introducing `binaryninja::open_view` and `binaryninja::open_view_with_options`, updated init/shutdown, script example, more setting support, and misc fixes
Diffstat (limited to 'rust/src/function.rs')
| -rw-r--r-- | rust/src/function.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs index 41c3a973..4230900f 100644 --- a/rust/src/function.rs +++ b/rust/src/function.rs @@ -68,7 +68,7 @@ impl Iterator for NativeBlockIter { None } else { self.bv - .get_instruction_len(&self.arch, res) + .instruction_len(&self.arch, res) .map(|x| { self.cur += x as u64; res @@ -112,15 +112,15 @@ impl BlockContext for NativeBlock { #[derive(PartialEq, Eq, Hash)] pub struct Function { - handle: *mut BNFunction, + pub(crate) handle: *mut BNFunction, } unsafe impl Send for Function {} unsafe impl Sync for Function {} impl Function { - pub(crate) unsafe fn from_raw(handle: *mut BNFunction) -> Self { - Self { handle } + pub(crate) unsafe fn from_raw(handle: *mut BNFunction) -> Ref<Self> { + Ref::new(Self { handle }) } pub fn arch(&self) -> CoreArchitecture { @@ -140,7 +140,7 @@ impl Function { pub fn view(&self) -> Ref<BinaryView> { unsafe { let view = BNGetFunctionData(self.handle); - Ref::new(BinaryView::from_raw(view)) + BinaryView::from_raw(view) } } @@ -282,6 +282,6 @@ unsafe impl<'a> CoreOwnedArrayWrapper<'a> for Function { type Wrapped = Guard<'a, Function>; unsafe fn wrap_raw(raw: &'a *mut BNFunction, context: &'a ()) -> Guard<'a, Function> { - Guard::new(Function::from_raw(*raw), context) + Guard::new(Function { handle: *raw }, context) } } |
