Implement ObjParser::parse_sections
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -115,7 +115,7 @@ pub struct ObjectParser {
|
||||
impl ObjectParser {
|
||||
pub fn parse(&mut self) -> Result<Object> {
|
||||
let header = self.parse_header()?;
|
||||
let sections = self.parse_sections()?;
|
||||
let sections = self.parse_sections(header)?;
|
||||
Ok(Object { header, sections })
|
||||
}
|
||||
|
||||
@@ -127,8 +127,10 @@ impl ObjectParser {
|
||||
Ok(Header { version, sections })
|
||||
}
|
||||
|
||||
fn parse_sections(&mut self) -> Result<Vec<Box<dyn Section>>> {
|
||||
todo!()
|
||||
fn parse_sections(&mut self, header: Header) -> Result<Vec<Box<dyn Section>>> {
|
||||
(0..header.sections)
|
||||
.map(|_| self.parse_section())
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn parse_section(&mut self) -> Result<Box<dyn Section>> {
|
||||
|
||||
Reference in New Issue
Block a user