fn parse_table_head(iterator: &mut EventIterator) -> Result<TableHead, ParseError> {
  let start = iterator.start();
  let mut cells = Vec::new();

  while let Some(event) = iterator.next() {
    match event {
      Event::End(Tag::TableHead) => break,
      Event::Start(Tag::TableCell) => cells.push(parse_table_cell(iterator)?),
      _ => {
        return Err(ParseError::new(
          iterator.get_last_range(),
          &format!("Unexpected event kind in table head: {:?}", event),
        ))
      }
    }
  }

  Ok(TableHead {
    range: iterator.get_range_for_start(start),
    cells,
  })
}
// todo: lots of duplicate code here... something should be done
lots of duplicate code here... something should be done
lots of duplicate code here ... something should be done
fn parse_table_head(iterator: &mut EventIterator) -> Result<TableHead, ParseError> {
  let start = iterator.start();
  let mut cells = Vec::new();
  while let Some(event) = iterator.next() {
    match event {
      Event::End(Tag::TableHead) => break,
      Event::Start(Tag::TableCell) => cells.push(parse_table_cell(iterator)?),
      _ => {
        return Err(ParseError::new(
          iterator.get_last_range(),
          &format!("Unexpected event kind in table head: {:?}", event),
        ))
      }
    }
  }
  Ok(TableHead {
    range: iterator.get_range_for_start(start),
    cells,
  })
}
fn parse_table_head ( iterator : & mut EventIterator ) -> Result < TableHead , ParseError > { let start = iterator . start ( ) ; let mut cells = Vec :: new ( ) ; while let Some ( event ) = iterator . next ( ) { match event { Event :: End ( Tag :: TableHead ) => break , Event :: Start ( Tag :: TableCell ) => cells . push ( parse_table_cell ( iterator ) ? ) , _ => { return Err ( ParseError :: new ( iterator . get_last_range ( ) , & format ! ( " " event ) , ) ) } } } Ok ( TableHead { range : iterator . get_range_for_start ( start ) , cells , } ) }
todo: lots of duplicate code here... something should be done
todo : lots of duplicate code here ... something should be done
iterator
&mut EventIterator
iterator
&mut EventIterator