Struct lc3_ensemble::asm::ObjectFile
source · pub struct ObjectFile { /* private fields */ }Expand description
An object file.
This is the final product after assembly source code is fully assembled. This can be loaded in the simulator to run the assembled code.
Implementations§
source§impl ObjectFile
impl ObjectFile
sourcepub fn write_bytes(&self) -> Vec<u8>
pub fn write_bytes(&self) -> Vec<u8>
Writes an object file into a byte vector.
sourcepub fn read_bytes(vec: &[u8]) -> Option<ObjectFile>
pub fn read_bytes(vec: &[u8]) -> Option<ObjectFile>
Reads a byte slice back into object file information, returning None if a parsing error occurs.
source§impl ObjectFile
impl ObjectFile
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new, empty ObjectFile.
sourcepub fn push(
&mut self,
start: u16,
start_span: Range<usize>,
words: Vec<Option<u16>>
) -> Result<(), AsmErr>
pub fn push( &mut self, start: u16, start_span: Range<usize>, words: Vec<Option<u16>> ) -> Result<(), AsmErr>
Add a new block to the object file, writing the provided words (words) at the provided address (start).
This will error if this block overlaps with another block already present in the object file.
sourcepub fn iter(&self) -> impl Iterator<Item = (u16, &[Option<u16>])>
pub fn iter(&self) -> impl Iterator<Item = (u16, &[Option<u16>])>
Get an iterator over all of the blocks of the object file.
sourcepub fn symbol_table(&self) -> Option<&SymbolTable>
pub fn symbol_table(&self) -> Option<&SymbolTable>
Gets the symbol table if it is present in the object file.
Trait Implementations§
source§impl Debug for ObjectFile
impl Debug for ObjectFile
Auto Trait Implementations§
impl Freeze for ObjectFile
impl RefUnwindSafe for ObjectFile
impl Send for ObjectFile
impl Sync for ObjectFile
impl Unpin for ObjectFile
impl UnwindSafe for ObjectFile
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more