Skip to content

Commit

Permalink
LineColIterator doesn't need to be peekable.
Browse files Browse the repository at this point in the history
  • Loading branch information
erickt committed Apr 26, 2015
1 parent 7cc319a commit 75af812
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/iterator.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::iter::Peekable;
use std::io;

pub struct LineColIterator<Iter: Iterator<Item=io::Result<u8>>> {
rdr: Peekable<Iter>,
rdr: Iter,
line: usize,
col: usize,
}
Expand All @@ -12,14 +11,7 @@ impl<Iter: Iterator<Item=io::Result<u8>>> LineColIterator<Iter> {
LineColIterator {
line: 1,
col: 0,
rdr: iter.peekable(),
}
}
fn peek(&mut self) -> Option<u8> {
match self.rdr.peek() {
None => None,
Some(&Ok(c)) => Some(c),
Some(&Err(_)) => None,
rdr: iter,
}
}
pub fn line(&self) -> usize { self.line }
Expand Down

0 comments on commit 75af812

Please sign in to comment.