Implement ObjParser::parse_sections

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-01-28 19:17:35 -05:00
parent 2148fed5a5
commit e8b874a3c9

View File

@@ -115,7 +115,7 @@ pub struct ObjectParser {
impl ObjectParser { impl ObjectParser {
pub fn parse(&mut self) -> Result<Object> { pub fn parse(&mut self) -> Result<Object> {
let header = self.parse_header()?; let header = self.parse_header()?;
let sections = self.parse_sections()?; let sections = self.parse_sections(header)?;
Ok(Object { header, sections }) Ok(Object { header, sections })
} }
@@ -127,8 +127,10 @@ impl ObjectParser {
Ok(Header { version, sections }) Ok(Header { version, sections })
} }
fn parse_sections(&mut self) -> Result<Vec<Box<dyn Section>>> { fn parse_sections(&mut self, header: Header) -> Result<Vec<Box<dyn Section>>> {
todo!() (0..header.sections)
.map(|_| self.parse_section())
.collect()
} }
fn parse_section(&mut self) -> Result<Box<dyn Section>> { fn parse_section(&mut self) -> Result<Box<dyn Section>> {