summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-10 20:00:43 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commit663225b7a25b36ab93fb008c20ddb316879f22fb (patch)
tree6957b1be6aa9d07b7344af0acbb907c64e6748b1 /rust/src
parent7e32ee8b629e3e4f8d061cbe0729ff961b3502d7 (diff)
[Rust] Move `BinaryReader` and `BinaryWriter` into `binary_view` module
Both of these are associated directly to a `BinaryView` and only exist as accessors onto it.
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/binary_view.rs7
-rw-r--r--rust/src/binary_view/reader.rs (renamed from rust/src/binary_reader.rs)4
-rw-r--r--rust/src/binary_view/writer.rs (renamed from rust/src/binary_writer.rs)0
-rw-r--r--rust/src/lib.rs2
4 files changed, 8 insertions, 5 deletions
diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs
index 65bab463..1aa97891 100644
--- a/rust/src/binary_view.rs
+++ b/rust/src/binary_view.rs
@@ -26,7 +26,6 @@ use binaryninjacore_sys::*;
use crate::architecture::{Architecture, CoreArchitecture};
use crate::base_detection::BaseAddressDetection;
use crate::basic_block::BasicBlock;
-use crate::binary_view::memory_map::MemoryMap;
use crate::component::Component;
use crate::confidence::Conf;
use crate::data_buffer::DataBuffer;
@@ -66,6 +65,12 @@ use std::{result, slice};
// TODO : general reorg of modules related to bv
pub mod memory_map;
+pub mod reader;
+pub mod writer;
+
+pub use memory_map::MemoryMap;
+pub use reader::BinaryReader;
+pub use writer::BinaryWriter;
pub type Result<R> = result::Result<R, ()>;
pub type BinaryViewEventType = BNBinaryViewEventType;
diff --git a/rust/src/binary_reader.rs b/rust/src/binary_view/reader.rs
index e96e552a..7b49f28d 100644
--- a/rust/src/binary_reader.rs
+++ b/rust/src/binary_view/reader.rs
@@ -68,12 +68,12 @@ impl BinaryReader {
unsafe { BNSetBinaryReaderVirtualBase(self.handle, virtual_base_addr) }
}
- /// Prefer using [crate::binary_reader::BinaryReader::seek] over this.
+ /// Prefer using [crate::reader::BinaryReader::seek] over this.
pub fn seek_to_offset(&mut self, offset: u64) {
unsafe { BNSeekBinaryReader(self.handle, offset) }
}
- /// Prefer using [crate::binary_reader::BinaryReader::seek] over this.
+ /// Prefer using [crate::reader::BinaryReader::seek] over this.
pub fn seek_to_relative_offset(&mut self, offset: i64) {
unsafe { BNSeekBinaryReaderRelative(self.handle, offset) }
}
diff --git a/rust/src/binary_writer.rs b/rust/src/binary_view/writer.rs
index 176a54d8..176a54d8 100644
--- a/rust/src/binary_writer.rs
+++ b/rust/src/binary_view/writer.rs
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 1b02da0d..80baae43 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -32,9 +32,7 @@ pub mod architecture;
pub mod background_task;
pub mod base_detection;
pub mod basic_block;
-pub mod binary_reader;
pub mod binary_view;
-pub mod binary_writer;
pub mod calling_convention;
pub mod collaboration;
pub mod command;