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 {
|
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>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user