summaryrefslogtreecommitdiff
path: root/rust/src/function.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-12-06 17:06:16 -0500
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-12-10 17:35:19 -0500
commit7090d904513c3e80321bb6a8aba9c3b37d809bac (patch)
tree0a329b0d6b01c4bd7a2ed9547f6862fce8f08fa1 /rust/src/function.rs
parente699fec29106d46303ef4bcb464a768e23bb28ea (diff)
[Rust] Remove redundant `ArchAndAddr` type
Use `Location` instead, `arch` can be a nullptr
Diffstat (limited to 'rust/src/function.rs')
-rw-r--r--rust/src/function.rs42
1 files changed, 6 insertions, 36 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs
index 5e4cf08a..1ef0a377 100644
--- a/rust/src/function.rs
+++ b/rust/src/function.rs
@@ -71,20 +71,21 @@ impl Location {
arch: Some(unsafe { CoreArchitecture::from_raw(arch) }),
}
}
+
+ pub fn new(arch: Option<CoreArchitecture>, addr: u64) -> Self {
+ Self { arch, addr }
+ }
}
impl From<u64> for Location {
fn from(addr: u64) -> Self {
- Location { arch: None, addr }
+ Location::new(None, addr)
}
}
impl From<(CoreArchitecture, u64)> for Location {
fn from(loc: (CoreArchitecture, u64)) -> Self {
- Location {
- arch: Some(loc.0),
- addr: loc.1,
- }
+ Location::new(Some(loc.0), loc.1)
}
}
@@ -2998,34 +2999,3 @@ unsafe impl CoreArrayProviderInner for Comment {
}
}
}
-
-#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
-pub struct ArchAndAddr {
- pub arch: CoreArchitecture,
- pub addr: u64,
-}
-
-impl ArchAndAddr {
- pub fn new(arch: CoreArchitecture, addr: u64) -> Self {
- Self { arch, addr }
- }
-}
-
-impl From<BNArchitectureAndAddress> for ArchAndAddr {
- fn from(raw: BNArchitectureAndAddress) -> Self {
- unsafe {
- let arch = CoreArchitecture::from_raw(raw.arch);
- let addr = raw.address;
- ArchAndAddr { arch, addr }
- }
- }
-}
-
-impl ArchAndAddr {
- pub fn into_raw(self) -> BNArchitectureAndAddress {
- BNArchitectureAndAddress {
- arch: self.arch.handle,
- address: self.addr,
- }
- }
-}