You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
620 B
Rust

4 years ago
use std::fmt::Display;
use crate::error::Error;
use crate::parts::Relocatable;
#[derive(Default)]
pub struct LinkState<'a> {
relocatables: Vec<Relocatable<'a>>,
}
impl<'a> LinkState<'a> {
pub fn add_relocatable(&mut self, relocatable: Relocatable<'a>) -> Result<(), Error> {
self.relocatables.push(relocatable);
Ok(())
}
}
impl Display for LinkState<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "===Relocatables===")?;
for r in self.relocatables.iter() {
writeln!(f, "{}", r)?;
}
Ok(())
}
}