diff options
| author | Rubens Brandão <git@rubens.io> | 2026-01-29 15:27:20 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-29 10:27:20 -0800 |
| commit | f06a8008a1f44fde0e77c693620d5128a6b8edc9 (patch) | |
| tree | 0e26035d014184ca892ee42aed10755b722dfbd5 /rust/src | |
| parent | ff58143ff7794d7251f9182294dd25bd4cbe15eb (diff) | |
[Rust] Make TagReference optionally take architecture and function (#7899)
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/tags.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/rust/src/tags.rs b/rust/src/tags.rs index 49dfae4a..bb0de957 100644 --- a/rust/src/tags.rs +++ b/rust/src/tags.rs @@ -16,6 +16,7 @@ use binaryninjacore_sys::*; use std::fmt::{Debug, Formatter}; +use std::ptr::NonNull; use crate::architecture::CoreArchitecture; use crate::binary_view::BinaryView; @@ -257,8 +258,8 @@ unsafe impl Sync for TagType {} #[derive(Clone, PartialEq)] pub struct TagReference { - pub arch: CoreArchitecture, - pub func: Ref<Function>, + pub arch: Option<CoreArchitecture>, + pub func: Option<Ref<Function>>, pub addr: u64, pub auto_defined: bool, pub reference_type: TagReferenceType, @@ -271,8 +272,10 @@ impl From<&BNTagReference> for TagReference { reference_type: value.refType, auto_defined: value.autoDefined, tag: unsafe { Tag::from_raw(value.tag).to_owned() }, - arch: unsafe { CoreArchitecture::from_raw(value.arch) }, - func: unsafe { Function::from_raw(value.func).to_owned() }, + arch: NonNull::new(value.arch) + .map(|arch| unsafe { CoreArchitecture::from_raw(arch.as_ptr()) }), + func: NonNull::new(value.func) + .map(|func| unsafe { Function::from_raw(func.as_ptr()).to_owned() }), addr: value.addr, } } |
