summaryrefslogtreecommitdiff
path: root/src/locators/bytecode_location.rs
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-02-04 08:38:56 +1300
committerBen Bridle <ben@derelict.engineering>2025-02-04 08:39:24 +1300
commit8ccb5b96f51bcf8e1a1c3e81d1305ff08825f9b1 (patch)
treef11318f8f98d7b39361faf0932b72d6dce1e3cd8 /src/locators/bytecode_location.rs
parent93b2bc229a8347a925df819b2d6199a1a6066cf0 (diff)
downloadassembler-8ccb5b96f51bcf8e1a1c3e81d1305ff08825f9b1.zip
Rename locator sub-modules
Diffstat (limited to 'src/locators/bytecode_location.rs')
-rw-r--r--src/locators/bytecode_location.rs39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/locators/bytecode_location.rs b/src/locators/bytecode_location.rs
deleted file mode 100644
index 500e9f0..0000000
--- a/src/locators/bytecode_location.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-pub struct BytecodeSpan {
- /// The location of this span in the assembled bytecode.
- pub location: BytecodeLocation,
- /// The bytes which this span represents.
- pub bytes: Vec<u8>,
-}
-
-
-impl Default for BytecodeSpan {
- fn default() -> Self {
- Self {
- location: BytecodeLocation {
- address: 0,
- length: 0,
- },
- bytes: Vec::new(),
- }
- }
-}
-
-
-#[derive(Clone, Copy)]
-pub struct BytecodeLocation {
- // Address of the first byte.
- pub address: usize,
- // Length as a number of bytes.
- pub length: usize,
-}
-
-
-impl std::fmt::Display for BytecodeLocation {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
- write!(f, "0x{:>04x}", self.address)?;
- if self.length > 0 {
- write!(f, "-0x{:>04x}", self.address + self.length)?;
- }
- Ok(())
- }
-}